Expand description
OpenTelemetry integration for the A2A server.
This module provides OtelMetrics, an implementation of the Metrics
trait that records request counts, error counts, latency histograms, and
queue depth to OpenTelemetry instruments. Data is exported via the OTLP
protocol (gRPC) using the opentelemetry-otlp crate.
§Module structure
| Module | Responsibility |
|---|---|
| (this file) | OtelMetrics struct and Metrics trait impl |
builder | OtelMetricsBuilder — fluent configuration |
pipeline | init_otlp_pipeline — OTLP export setup |
§Feature flag
This module is only available when the otel feature is enabled.
§Quick start
use a2a_protocol_server::otel::{OtelMetrics, OtelMetricsBuilder, init_otlp_pipeline};
// 1. Initialise the OTLP export pipeline (sets the global MeterProvider).
let provider = init_otlp_pipeline("my-a2a-agent")?;
// 2. Build the metrics instance.
let metrics = OtelMetricsBuilder::new()
.meter_name("a2a.server")
.build();
// 3. Pass `metrics` to `RequestHandlerBuilder::metrics(metrics)`.Structs§
- Otel
Metrics - A
Metricsimplementation backed by OpenTelemetry instruments. - Otel
Metrics Builder - Builder for
OtelMetrics.
Functions§
- init_
otlp_ pipeline - Initialise an OTLP metrics export pipeline and install it as the global
MeterProvider.