Skip to main content
A hybrid AI Gateway can push OpenTelemetry data to a Datadog Agent running as a sidecar in the gateway pod. The Agent forwards it to Datadog, where it shows up in two places:
  • 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

The gateway sends two separate OTLP streams to the sidecar: 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-otel with key dd_api_key. Don’t put the key in values.yaml or 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:
Setting TRUSTED_CUSTOM_HOSTS replaces the list. It doesn’t merge with what’s there. Append to your existing hosts, or internal MCP servers and custom hosts stop working.
2

Configure the gateway container

Add these to extraEnv in values.yaml:
  • EXPERIMENTAL_GEN_AI_OTEL_EXPORTER_OTLP_ENDPOINT is a base URL. The gateway appends /v1/traces.
  • Declare DD_API_KEY before the headers variable. Kubernetes only expands $(DD_API_KEY) when the variable is defined earlier in the same container.
  • OTEL_EXPORTER_OTLP_PROTOCOL applies to the analytics stream only.
  • Both deployment.environment.name and the older deployment.environment are set because Datadog maps the older one to env most reliably.
  • Keep OTEL_SERVICE_NAME set to portkey and leave service.name out of the resource attributes. See Service name.
3

Add the Datadog Agent sidecar

Add the Agent to sidecars in values.yaml:
  • Set DD_SITE to your Datadog site, for example datadoghq.eu or us5.datadoghq.com.
  • DD_ENV tags 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

Send a few requests through the gateway. Within a few minutes the portkey service appears in APM → Services, and the requests appear in APM → Traces and AI Observability.

Service name

The gateway always sets service.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.name to EXPERIMENTAL_GEN_AI_OTEL_RESOURCE_ATTRIBUTES has no effect.
  • DD_APM_SERVICE_MAPPING doesn’t apply to OTLP traces, so you can’t rename the service at the Agent either.
To keep everything under one service, set 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.

Troubleshooting

Last modified on October 17, 2026