Skip to main content
Available via: Kong’s OpenTelemetry plugin (any language calling through the gateway). This is not a Zespan SDK wrapper — see Send traces from any OTel-instrumented app for how the underlying endpoint works.
If you already route LLM traffic through Kong AI Gateway, enable Kong’s OpenTelemetry plugin on the relevant route or service and point it at Zespan — every call proxied through Kong is traced with GenAI-specific span attributes (model, provider, token counts), independent of which app made the call.

Setup

Enable the opentelemetry plugin on your AI Gateway route (declarative config shown; the same fields apply via the Admin API or kubectl/Konnect):
zespan.gateway: kong tells Zespan the spans come from Kong; without it, a custom service.name such as the one above means Kong’s AI spans are stored as plain OpenTelemetry (see AI gateways).
Kong’s plugin sends OTLP over HTTP with Protobuf (its page documents no JSON option). Zespan accepts Protobuf, so no protocol change is needed. Spans Kong sent before the October 2026 release may be missing; see OTel integration.

What gets captured

Kong AI Gateway’s LLM-specific spans carry GenAI semantic-convention attributes — model, provider, token usage — the same fields Zespan reads from any OTel source. Kong does not put cost on its spans (it reports cost as metrics), so Zespan prices each call from the model and token counts. Kong’s own core spans (router, balancer and similar) are exported in the same request and, once the source is recognised as Kong, are stored as gateway spans of the trace, without a model; they are not counted as model calls. Every request proxied through the gateway is traced regardless of the calling app’s language or framework, which is the main reason to route through a gateway in the first place. Prompt and completion text is stored only if Kong exports it and your project’s prompt storage setting allows it.
Attribute names come from Kong’s published documentation and can change between versions. Use the Gateway and OTLP data card to see what actually arrives. Check your plugin version’s fields for how to set custom headers.

Verify

Send one request through Kong, then open Settings → Instrumentation → Gateway and OTLP data and press Refresh. See Instrumentation.

Using the SDK too

If an app also uses the Zespan SDK for the same call, Zespan can count its tokens and cost once when merging is on (see the linked section) and Kong’s spans are recognised as Kong’s (keep zespan.gateway: kong from the setup above). Kong’s plugin can extract and inject W3C trace context (config.propagation), and its AI spans carry gen_ai.response.id, so the trace link (turn on gatewayCorrelation for your gateway’s host) and the response id can both match.

Next steps