AI Gateway supports OpenTelemetry instrumentation for generative AI traffic. When an OpenTelemetry (OTEL) Policy is enabled in AI Gateway, a set of Gen AI-specific attributes are emitted on tracing spans. These attributes provide insight into the Gen AI request lifecycle (inputs, model, and outputs), usage, and tool or agent interactions.
You can also capture Agent2Agent traffic (A2A) by enabling statistics logging on AI Agents.
You can export these attributes via a supported backend to:
- Inspect which AI Model or AI Model Provider handled a request
- Track A2A conversation and task identifiers across requests
- Analyze prompt structure (system vs. user vs. tool messages)
- Evaluate model parameters (such as temperature and max tokens)
- Measure tool-call behavior (which tools were invoked, and their metadata)
- Monitor token usage (input vs. output) for cost or performance analysis
The span data is sent to the configured OTEL endpoint through the Kong tracing. Use a Policy configured with OpenTelemetry or Zipkin to export these spans to backends such as Jaeger.
This page covers span attributes (per-request tracing data). AI Gateway also supports OTLP metrics (aggregated counters and histograms for latency, token usage, cost, and error rates). See the Gen AI OpenTelemetry metrics reference for details.
Some Gen AI span attributes can include sensitive request or response payload data. In particular,
gen_ai.input.messagesandgen_ai.output.messagesmay contain prompts, model outputs, PII, secrets, or credentials. Review your tracing, retention, access-control, and redaction requirements before enabling or exporting payload-related tracing data.