For the complete documentation index, see llms.txt. Markdown versions of all docs pages are available by appending .md to any docs URL.
OpenTelemetry
Integrate agentgateway with OpenTelemetry for distributed tracing and metrics
Agentgateway natively supports OpenTelemetry (OTLP) for distributed tracing and metrics export.
Configuration
Enable OpenTelemetry tracing in your agentgateway configuration.
# yaml-language-server: $schema=https://agentgateway.dev/schema/config
frontendPolicies:
tracing:
otlpEndpoint: http://localhost:4317
randomSampling: trueConfiguration options
| Setting | Description |
|---|---|
otlpEndpoint | The OTLP gRPC endpoint (e.g., http://localhost:4317) |
randomSampling | Enable random sampling for traces |
With Jaeger
Run Jaeger with OTLP support.
docker run -d --name jaeger \
-p 16686:16686 \
-p 4317:4317 \
jaegertracing/all-in-one:latestConfigure agentgateway.
# yaml-language-server: $schema=https://agentgateway.dev/schema/config
frontendPolicies:
tracing:
otlpEndpoint: http://localhost:4317
randomSampling: true
binds:
- port: 3000
listeners:
- routes:
- backends:
- mcp:
targets:
- name: my-server
stdio:
cmd: npx
args: ["@modelcontextprotocol/server-everything"]View traces at http://localhost:16686.
With OpenTelemetry Collector
For production deployments, use the OpenTelemetry Collector:
# otel-collector-config.yaml
receivers:
otlp:
protocols:
grpc:
endpoint: 0.0.0.0:4317
processors:
batch:
exporters:
jaeger:
endpoint: jaeger:14250
tls:
insecure: true
service:
pipelines:
traces:
receivers: [otlp]
processors: [batch]
exporters: [jaeger]Trace attributes
Agentgateway includes the following attributes in traces:
http.method- HTTP request methodhttp.url- Request URLhttp.status_code- Response status codemcp.method- MCP method name (for MCP requests)mcp.session_id- MCP session IDgen_ai.operation.name- AI operation type (for LLM requests)gen_ai.request.model- Requested modelgen_ai.usage.input_tokens- Input token countgen_ai.usage.output_tokens- Output token count