Skip to main content
Datadog accepts OpenTelemetry data through the Datadog Agent’s built-in OTLP receiver. Your application sends traces and metrics to the local Datadog Agent over localhost:4318, and the agent forwards them to the Datadog backend using your configured API key.

Prerequisites

This guide assumes you have a Datadog Agent already installed and configured with OTLP ingestion enabled. If you need to install the agent, refer to the Datadog Agent Installation Guide. To enable OTLP in the Datadog Agent, add the following to your datadog.yaml:
otlp_config:
  receiver:
    protocols:
      http:
        endpoint: 0.0.0.0:4318

Get started

1

Install the OpenLIT SDK

pip install openlit
2

Configure the SDK to send to the Datadog Agent

Point otlp_endpoint at the Datadog Agent running on localhost. No API key or authentication header is needed in the application — the agent handles authentication to the Datadog backend.
Using function arguments:
import openlit

openlit.init(
    otlp_endpoint="http://localhost:4318"
)
Using environment variables:
export OTEL_EXPORTER_OTLP_ENDPOINT="http://localhost:4318"
export OTEL_SERVICE_NAME="my-ai-service"
export OTEL_DEPLOYMENT_ENVIRONMENT="production"
import openlit

openlit.init()
The Datadog Agent handles authentication and forwarding to Datadog. You do not need to set otlp_headers or a Datadog API key in your application configuration.

Full example

import openlit
import openai

openlit.init(
    otlp_endpoint="http://localhost:4318",
    service_name="my-ai-service",
    environment="production"
)

client = openai.OpenAI()
response = client.chat.completions.create(
    model="gpt-4o",
    messages=[{"role": "user", "content": "Hello!"}]
)
print(response.choices[0].message.content)
Traces appear in Datadog APM under the service name my-ai-service.

Send to OpenLIT

Send to a self-hosted OpenLIT platform instance

Send to Grafana Cloud

Configure the Grafana OTLP gateway endpoint and Basic Auth headers

Integrations

60+ LLM providers, AI frameworks, and vector databases

Build docs developers (and LLMs) love