Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implementing label_value does not work #30

Open
ambuznego opened this issue Nov 18, 2021 · 1 comment
Open

Implementing label_value does not work #30

ambuznego opened this issue Nov 18, 2021 · 1 comment

Comments

@ambuznego
Copy link

I have the instrumenter working fine w/ default settings and I see my Ecto metrics come through prometheus:

# TYPE ecto_db_query_duration_microseconds histogram
# HELP ecto_db_query_duration_microseconds The time spent executing the DB query in microseconds.
ecto_db_query_duration_microseconds_bucket{result="ok",le="10"} 49
ecto_db_query_duration_microseconds_bucket{result="ok",le="100"} 49
ecto_db_query_duration_microseconds_bucket{result="ok",le="1000"} 49
ecto_db_query_duration_microseconds_bucket{result="ok",le="10000"} 49
ecto_db_query_duration_microseconds_bucket{result="ok",le="100000"} 49
ecto_db_query_duration_microseconds_bucket{result="ok",le="300000"} 49
ecto_db_query_duration_microseconds_bucket{result="ok",le="500000"} 49
ecto_db_query_duration_microseconds_bucket{result="ok",le="750000"} 49
ecto_db_query_duration_microseconds_bucket{result="ok",le="1000000"} 49
ecto_db_query_duration_microseconds_bucket{result="ok",le="1500000"} 49
ecto_db_query_duration_microseconds_bucket{result="ok",le="2000000"} 49
ecto_db_query_duration_microseconds_bucket{result="ok",le="3000000"} 49
ecto_db_query_duration_microseconds_bucket{result="ok",le="+Inf"} 49
ecto_db_query_duration_microseconds_count{result="ok"} 49
ecto_db_query_duration_microseconds_sum{result="ok"} 89.833

In looking for a way to identify which queries are taking how long, I am trying to implement the label_value function as suggested and just logging the 2nd argument so I can see what I can use:

defmodule App.Repo.Instrumenter do
  use Prometheus.EctoInstrumenter

  def label_value(:source, log_entry) do
   IO.
    IO.inspect log_entry
    true
  end
end

But it doesn't seem to ever enter this function... It doesn't log anything and I don't see "source" in the labeling as I would expect...

Is there any additional steps to get this to work?

@ambuznego
Copy link
Author

@deadtrickster any insight? thanks!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant