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

Record Idle Time, Add Repo Label & Make config accessible in label_value() #28

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

ackerdev
Copy link

@ackerdev ackerdev commented Mar 10, 2021

Adds support for the new idle_time metric introduced in ecto_sql 3.3.0, adds repo labeling, and allows config to be accessed in label_value().

Repo label and the config change would be breaking changes.

For some context on the label_value() config change, my usecase is that we have multiple repos across multiple apps within an umbrella application. We want to be able to record both the repo and app so we can split out results in our dashboards appropriately. This change will allow me to do the following:

:telemetry.attach_many("handler-id", repo_query_event_names, &MyRepoInstrumenter.handle_event/4, %{application: :my_app})

defmodule MyRepoInstrumenter do
  use Prometheus.EctoInstrumenter

  def label_value(:application, _entry, config) do
    config.application
  end
end

I tried to split each change into it's own commit if you want to pick-and-choose which changes to accept or review them individually.

Closes #26

@ackerdev ackerdev changed the title Record Idle Time & Add Repo Label Record Idle Time, Add Repo Label & Make config accessible in label_value() Mar 11, 2021
@deadtrickster
Copy link
Owner

Hi, thank you for this. Please bump version in mix.exs

@ackerdev
Copy link
Author

Done, thank you for taking the time to review & merge!

@ackerdev
Copy link
Author

Also, added some docs updates that will also close #24

@NicolasMarlier
Copy link

Hi, this MR looks gorgeous! Any chance it can be merged soon?

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

Successfully merging this pull request may close these issues.

Instrument new idle_time metric introduced on ecto_sql 3.3.0
3 participants