akoutmos / prom_ex

An Elixir Prometheus metrics collection library built on top of Telemetry with accompanying Grafana dashboards
MIT License
577 stars 96 forks source link

Ecto metrics "source_unavailable" #229

Open tyhill3 opened 4 months ago

tyhill3 commented 4 months ago

Describe the bug I don't think this is a bug, I'm just not sure why I get "source_unavailable" for my Ecto metrics.

Expected behavior I see in the code:

    defp ecto_query_tag_values(%{repo: repo, source: source, result: result}) do
      %{
        repo: repo |> Atom.to_string() |> String.trim_leading("Elixir."),
        source: normalize_source(source),
        command: normalize_command(result)
      }
    end

    defp normalize_source(nil), do: "source_unavailable"
    defp normalize_source(source) when is_binary(source), do: source
    defp normalize_source(source) when is_atom(source), do: Atom.to_string(source)
    defp normalize_source(_), do: "source_unavailable"

What scenarios result in "source_unavailable"? I see the &ecto_query_tag_values/1 call, but I'm not sure why I keep resulting in "source_unavailable".