- APM: a service for the gateway, per-request traces, and inferred services for the upstream LLM providers
- AI Observability: per-request GenAI spans
Available on hybrid deployments only. The AI Gateway SaaS can’t push telemetry to your Datadog account.
How it works
Enabling the analytics stream alone gives you no traces.
Prerequisites
- A hybrid AI Gateway deployed with the Helm chart
- A Datadog API key stored in a Kubernetes Secret, for example
datadog-otelwith keydd_api_key. Don’t put the key invalues.yamlor Git.
Setup
1
Allow the gateway to reach localhost
The gateway’s SSRF guard blocks loopback addresses in production, so the push to the sidecar fails until you allow it. Add
localhost, 127.0.0.1 and ::1 to TRUSTED_CUSTOM_HOSTS:2
Configure the gateway container
Add these to
extraEnv in values.yaml:EXPERIMENTAL_GEN_AI_OTEL_EXPORTER_OTLP_ENDPOINTis a base URL. The gateway appends/v1/traces.- Declare
DD_API_KEYbefore the headers variable. Kubernetes only expands$(DD_API_KEY)when the variable is defined earlier in the same container. OTEL_EXPORTER_OTLP_PROTOCOLapplies to the analytics stream only.- Both
deployment.environment.nameand the olderdeployment.environmentare set because Datadog maps the older one toenvmost reliably. - Keep
OTEL_SERVICE_NAMEset toportkeyand leaveservice.nameout of the resource attributes. See Service name.
3
Add the Datadog Agent sidecar
Add the Agent to
sidecars in values.yaml:- Set
DD_SITEto your Datadog site, for exampledatadoghq.euorus5.datadoghq.com. DD_ENVtags the analytics stream with your environment.- The gateway container runs with
readOnlyRootFilesystem: true. That setting doesn’t apply to the sidecar, which needs a writable root filesystem (the Kubernetes default).
4
Deploy
portkey service appears in APM → Services, and the requests appear in APM → Traces and AI Observability.Service name
The gateway always setsservice.name=portkey as the first resource attribute on GenAI spans. When spans go through the Agent, the first duplicate attribute wins. Datadog’s direct intake does the opposite and keeps the last one. Two consequences:
- Adding
service.nametoEXPERIMENTAL_GEN_AI_OTEL_RESOURCE_ATTRIBUTEShas no effect. DD_APM_SERVICE_MAPPINGdoesn’t apply to OTLP traces, so you can’t rename the service at the Agent either.
OTEL_SERVICE_NAME=portkey. That moves the analytics stream and the gateway’s request spans under the same portkey service as the GenAI spans.
Don’t send the dd-otlp-source=llmobs header
Datadog documents a dd-otlp-source=llmobs header for sending OTLP to AI Observability. That header is meant for Datadog’s direct intake. Sent through the Agent, it routes spans to AI Observability only, and APM gets no traces or inferred services. Leave it out: without it, the Agent sends spans to APM, inferred services and AI Observability.

