Excessibility.TelemetryCapture.Enrichers.EctoQueries (Excessibility v0.14.0)
View SourceEnriches timeline events with Ecto query information.
Provides two mechanisms:
- Telemetry handler — attaches to
[:ecto, :query]events during test execution. Callattach/0before tests anddetach/0after. - Enricher callback — reads captured queries from opts or the query store.
Example Output
%{
ecto_queries: [
%{source: "products", operation: :select, duration_ms: 1.2, query: "SELECT..."}
],
ecto_query_count: 2,
ecto_total_query_ms: 2.0
}
Summary
Functions
Attaches a telemetry handler to [:ecto, :query] events.
Clears all recorded queries.
Returns the cost of this enricher.
Detaches the telemetry handler.
Enriches assigns with Ecto query data.
Returns all recorded queries in order.
Returns the enricher name.
Records a query in the store.
Starts the Agent-based query store.
Stops the query store.
Functions
Attaches a telemetry handler to [:ecto, :query] events.
Clears all recorded queries.
Returns the cost of this enricher.
Detaches the telemetry handler.
Enriches assigns with Ecto query data.
Reads queries from the :ecto_queries key in opts.
Returns query list, count, and total duration.
Returns all recorded queries in order.
Returns the enricher name.
Records a query in the store.
Starts the Agent-based query store.
Stops the query store.
Idempotent and race-safe: safe to call concurrently from multiple
on_exit callbacks when tests share the globally-named Agent.