Skip to main content
Agentgateway emits telemetry through three channels:
  • Distributed traces via OTLP to any OpenTelemetry-compatible backend (Jaeger, Grafana Tempo, etc.)
  • Prometheus metrics scraped from a configurable stats address
  • Structured logs written to stdout with configurable level and format

Distributed tracing

Tracing is configured under config.tracing (static config file) or frontendPolicies.tracing (dynamic config). Send traces to any OTLP endpoint:
Or with the frontendPolicies form used in the telemetry example:

Tracing fields

Sampling

randomSampling controls whether agentgateway starts new traces for requests that arrive without a trace context. It accepts:
  • true / false — sample all or none
  • A float between 0.0 and 1.0 — percentage of requests to sample
  • A CEL expression that evaluates to a float or boolean
clientSampling controls whether to propagate traces that arrive with an existing traceparent header. It defaults to true (always propagate).

Span fields

Add custom attributes to all spans, or remove default attributes:

Access log export via OTLP

Export access logs as OpenTelemetry LogRecords alongside the default stdout output:

Prometheus metrics

Metrics are enabled by default and exposed at /metrics on a dedicated stats address. Configure the address with config.statsAddr:
If statsAddr is not set, agentgateway defaults to an internal address. Scrape the endpoint to verify:
Example output:

Key metrics

Kubernetes scraping

The Helm chart configures Prometheus scraping annotations on pods by default:

Structured logging

Configure log level and format under config.logging:

Logging fields

Log level examples

Running the telemetry example

1

Start a local Jaeger instance

2

Start agentgateway with tracing enabled

3

Send requests via MCP Inspector

Connect to http://localhost:3000 and invoke a few tools to generate trace data.
4

View traces in Jaeger

Open http://localhost:16686/search and search for agentgateway spans.
5

Check metrics

OpenTelemetry Collector

For production deployments, route telemetry through the OpenTelemetry Collector. The example otel-collector-config.yaml fans out traces to Jaeger and logs to stdout:

Grafana integration

A Grafana dashboard JSON file is included at manifests/grafana.json. Import it into your Grafana instance to visualize agentgateway metrics alongside traces from Jaeger or Grafana Tempo.
Agentgateway implements the OpenTelemetry Gen AI semantic conventions v1.37.0 for AI-specific span attributes, including model name, token counts, and provider information.