prometheus-ecto
prometheus-ecto copied to clipboard
Record Idle Time, Add Repo Label & Make config accessible in label_value()
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
Hi, thank you for this. Please bump version in mix.exs
Done, thank you for taking the time to review & merge!
Also, added some docs updates that will also close #24
Hi, this MR looks gorgeous! Any chance it can be merged soon?