OpenTelemetry Integration
Send LLM traces to Ingate using the standard OTLP/HTTP protocol. Compatible with any OpenTelemetry SDK.
Overview
Ingate includes a built-in OTLP/HTTP trace receiver at /v1/traces. If your application is already instrumented with OpenTelemetry, you can export GenAI spans directly to Ingate when their attributes match the supported mapping below. Configure the exporter and gateway header.
Endpoint
/v1/tracesOTLP/HTTP trace export. Accepts protobuf and JSON.
Content Types
| Content-Type | Format |
|---|---|
application/x-protobuf | Standard protobuf encoding (recommended) |
application/json | JSON encoding |
Configuration
Point your OpenTelemetry exporter at Ingate:
# Set the OTLP endpoint to Ingate
export OTEL_EXPORTER_OTLP_ENDPOINT=https://api.ingateai.com
export OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf
# Authenticate with your Ingate API key
export OTEL_EXPORTER_OTLP_HEADERS="X-Ingate-Key=$INGATE_KEY"Python Example
import os
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.trace.export import BatchSpanProcessor
from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter
provider = TracerProvider()
exporter = OTLPSpanExporter(
endpoint="https://api.ingateai.com/v1/traces",
headers={"X-Ingate-Key": os.environ["INGATE_KEY"]}
)
provider.add_span_processor(BatchSpanProcessor(exporter))GenAI Span Filtering
Ingate processes only GenAI-related spans from the trace payload. Other spans (HTTP, database, etc.) are ignored. Admission requires a span attribute keygen_ai.provider.name or gen_ai.operation.name; a model or resource-only provider does not admit a span. Provider then falls back from span to resource to unknown.
Mapped Fields
GenAI span attributes are mapped to Ingate's unified log format:
| OTel Attribute | Ingate Field |
|---|---|
gen_ai.provider.name | String: provider |
gen_ai.operation.name | String: operation mapped to path |
gen_ai.request.model / gen_ai.response.model | String: request model, then response fallback |
gen_ai.input.messages / gen_ai.output.messages | JSON-encoded string arrays: first matching user/assistant text part, or direct content |
gen_ai.usage.input_tokens / gen_ai.usage.output_tokens | Integer AnyValue: input_tokens / output_tokens |
gen_ai.user.id / gen_ai.session.id | String: span, then resource fallback |
gen_ai.response.id | String: request ID, otherwise generated |
gen_ai.response.finish_reasons / error.type | String metadata |
| Span duration | latency_ms |
Counts must be integer AnyValues from 0 to 2147483647. Missing stays null; explicit zero is observed. Invalid types/ranges are unparsed, never zero-filled. Total is derived only when both halves exist and their sum fits. Cache-read, cache-write and reasoning classes remain unknown; vendor aliases and the older system/prompt/completion token names are not mapped.
{
"name": "illustrative-chat",
"attributes": [
{"key": "gen_ai.provider.name", "value": {"stringValue": "openai"}},
{"key": "gen_ai.operation.name", "value": {"stringValue": "chat"}},
{"key": "gen_ai.request.model", "value": {"stringValue": "gpt-4o-mini"}},
{"key": "gen_ai.usage.input_tokens", "value": {"intValue": "10"}},
{"key": "gen_ai.usage.output_tokens", "value": {"intValue": "0"}},
{"key": "gen_ai.input.messages", "value": {"stringValue": "[{\"role\":\"user\",\"content\":\"Hello\"}]"}},
{"key": "gen_ai.output.messages", "value": {"stringValue": "[{\"role\":\"assistant\",\"parts\":[{\"type\":\"text\",\"content\":\"Hi\"}]}]"}}
]
}Message arrays are encoded inside stringValue, not native OTLP arrays. Body storage depends on capture policy. Legacy OTel uses asynchronous admission; it is not a durable REST receipt. Controlled telemetry organizations refuse OTel producers. See admission modes and recovery.
Request Limits
Maximum request body size: 4 MB. Payloads exceeding this limit receive413 Request Entity Too Large.
Complementary to the proxy
Exporting Traces Out
This page covers traces flowing into Ingate. Ingate can also stream gateway traces out, as OTLP spans following the GenAI semantic conventions, or as signed webhooks, via export configs. See Trace Exports for the config reference, and the Arize Phoenix and Langfuse guides for wiring exports into those tools.