Times every query a given Ecto.Repo runs, kind: "query". Call once at startup, passing the
repo module itself:
ForgeOpsTracker.Integrations.Ecto.attach(MyApp.Repo)Unlike ForgeOpsTracker.Integrations.Phoenix/Oban, this needs the repo handed over explicitly
rather than attaching to one fixed global event name: confirmed directly against the installed
ecto/ecto_sql source, Ecto.Adapters.SQL's own query logging emits telemetry_prefix ++ [:query], where telemetry_prefix defaults to the repo module's own name, underscored
(MyApp.Repo -> [:my_app, :repo]), but is stored on the repo's own runtime config
(repo.config()[:telemetry_prefix], which also respects a host app that set a custom prefix
explicitly), not a name this module could otherwise guess. Call once per repo if the host app
has more than one.
measurements.total_time is already query_time + decode_time + queue_time summed (Ecto's own
Ecto.Adapters.SQL computes this exact total for its own query logging), native time units.
metadata.source is the table name directly for any query built from Ecto.Query (the common
case), nil for a raw SQL call; see ForgeOpsTracker.QueryNaming for how each is turned into a
low-cardinality transaction_name.
Summary
Functions
Registers the telemetry handler for repo. Safe to call more than once for the same repo.
Functions
@spec attach(module()) :: :ok
Registers the telemetry handler for repo. Safe to call more than once for the same repo.