This PR adds OpenTelemetry support for access logs with examples. Example LogRecord in OTel collector's debugexporter: ``` 2026-02-28T16:25:54.392Z info ResourceLog #0 Resource SchemaURL: Resource attributes: -> service.name: Str(default) -> telemetry.sdk.version: Str(0.31.0) -> telemetry.sdk.name: Str(opentelemetry) -> telemetry.sdk.language: Str(rust) -> host.name: Str(default.default.svc.cluster.local) -> service.namespace: Str(default) -> service.version: Str(7da75b0d38c03fb76a9f8c010a4f8de0d7e2b03f-dirty) ScopeLogs #0 ScopeLogs SchemaURL: InstrumentationScope request LogRecord #0 ObservedTimestamp: 2026-02-28 16:25:53.359094924 +0000 UTC Timestamp: 1970-01-01 00:00:00 +0000 UTC SeverityText: INFO SeverityNumber: Info(9) Body: Empty() Attributes: -> gateway: Str(default/default) -> listener: Str(listener0) -> route: Str(default/route0) -> src.addr: Str([::1]:55174) -> http.method: Str(GET) -> http.host: Str(localhost) -> http.path: Str(/sse) -> http.version: Str(HTTP/1.1) -> http.status: Int(200) -> trace.id: Str(9b075b593dad653b104d9411cd02169c) -> span.id: Str(97fa138ccc3e5f65) -> protocol: Str(mcp) -> duration: Str(62288ms) Trace ID: 9b075b593dad653b104d9411cd02169c Span ID: 97fa138ccc3e5f65 Flags: 0 ```
Telemetry Example
This example shows how to use the agentgateway to visualize traces and metrics for MCP calls. This builds upon the RBAC sample. While you can use tracing without RBAC, this example uses both together to showcase augmenting traces with information from the authenicated user.
Running the example
cargo run -- -f examples/telemetry/config.yaml
Let's look at the config to understand what's going on.
In addition to the baseline configuration we had previously, we have a new config tracing section, which tells the proxy how to trace requests.
config:
tracing:
otlpEndpoint: http://localhost:4317
Here, we configure sending traces to an OTLP endpoint.
For metrics, they are enabled by default so no configuration is needed
Next, we will want to get a tracing backend running.
You can use any OTLP endpoint if you already have one, or run a local Jaeger instance by running docker compose up -d
Send a few requests from the MCP inspector to generate some telemetry.
Now we can open the Jaeger UI and search for our spans:
We can also see the metrics (typically, Prometheus would scrape these):
$ curl localhost:15020/metrics -s | grep -v '#'
tool_calls_total{server="everything",name="echo"} 1
tool_calls_total{server="everything",name="add"} 1
list_calls_total{resource_type="tool"} 3
agentgateway_requests_total{gateway="bind/3000",method="POST",status="200"} 9
agentgateway_requests_total{gateway="bind/3000",method="POST",status="202"} 4
agentgateway_requests_total{gateway="bind/3000",method="GET",status="200"} 1
agentgateway_requests_total{gateway="bind/3000",method="DELETE",status="202"} 2
