View Source Agens.Metrics (agens v0.2.0)
Telemetry.Metrics definitions for the events emitted by Agens.
The list returned by metrics/0 is intended to be supplied to a
Telemetry.Metrics.Reporter (for example TelemetryMetricsPrometheus,
TelemetryMetricsStatsd, or your own reporter) in your application's
supervision tree.
Wiring into a parent application
Add a Telemetry.Metrics.Supervisor (or reporter of your choice) to your
application's supervision tree and feed it Agens.Metrics.metrics/0:
defmodule MyApp.Application do
use Application
def start(_type, _args) do
children = [
{Agens.Supervisor, name: Agens.Supervisor},
{TelemetryMetricsPrometheus, metrics: Agens.Metrics.metrics()}
# ...your own children
]
Supervisor.start_link(children, strategy: :one_for_one)
end
endTo combine Agens metrics with metrics from your own app:
def metrics do
Agens.Metrics.metrics() ++ my_app_metrics()
endEvent coverage
Metrics are emitted for the following event prefixes:
[:agens, :serving, ...]- Serving lifecycle, enqueue, and result duration / exceptions (via:telemetry.span/3).[:agens, :job, ...]- Job lifecycle, status changes, yields and errors.[:agens, :node, ...]- Per-Node start, result, and retry events.[:agens, :sub, ...]- Sub-Job lifecycle from the parent's perspective: dispatch (:start),Agens.Serving.handle_sub/3invocation (:handle), completion routed back to parent (:done), and propagated failure (:error).[:agens, :tool, :call, ...]- Tool calls with duration and exception coverage (span).[:agens, :resource, :load, ...]- Resource loads with duration and exception coverage (span).
Summary
Functions
Returns the list of Telemetry.Metrics definitions for all Agens events.
Functions
@spec metrics() :: [Telemetry.Metrics.t()]
Returns the list of Telemetry.Metrics definitions for all Agens events.