Skip to main content

Module telemetry

Module telemetry 

Source
Expand description

OpenTelemetry metrics. Every instrument the gateway emits lives on one GatewayMetrics, passed explicitly (there is no global recorder). The Prometheus and OTLP exporters sit behind the server feature.

Re-exports§

pub use exporter::install;
pub use exporter::metrics_router;
pub use exporter::MetricsExporter;

Structs§

GatewayMetrics
Every instrument the gateway records. Build once, share behind an Arc.
MetricsExporter
The Prometheus registry plus the provider feeding it. Keep it alive for the process lifetime: dropping the last provider handle shuts every reader down, and scrapes come back empty.

Constants§

SECONDS_BUCKETS
Second-scaled histogram boundaries; OTel’s defaults are millisecond-scaled.

Functions§

install
Build the meter provider and the gateway’s instruments. Prometheus is always on; OTLP/HTTP is added when otlp_endpoint (a base collector URL such as http://collector:4318) is set. opentelemetry-otlp 0.32 uses programmatic endpoints verbatim, so /v1/metrics is appended here.
metrics_router
GET /metrics (and GET /) in Prometheus text format.
seconds_histogram
A duration histogram in seconds with SECONDS_BUCKETS boundaries.