> ## Documentation Index
> Fetch the complete documentation index at: https://docs.openlit.io/llms.txt
> Use this file to discover all available pages before exploring further.

# DataDog

> LLM Observability with DataDog and OpenLIT

<Frame>
  <img src="https://datadog-docs.imgix.net/images/getting_started/opentelemetry/otel_demo/trace_waterfall.e1b3a6d28322156488acc866ed381508.png?auto=format" />
</Frame>

To send OpenTelemetry metrics and traces generated by OpenLIT from your AI Application to DataDog via the DataDog Agent, follow the below steps.

### 1. DataDog Agent Setup

```mermaid theme={null}
graph LR
    A[AI Application<br/>Instrumented by OpenLIT] --> B[DataDog Agent<br/>localhost:4318]
    B --> C[DataDog Backend<br/>APM & Logs]
```

<Note>
  **Prerequisites**: This guide assumes you have a DataDog Agent already installed and configured with OpenTelemetry support.
  If you need to install the DataDog Agent, please refer to the [DataDog Agent Installation Guide](https://docs.datadoghq.com/agent/).
</Note>

### 2. Instrument your application

<Tabs>
  <Tab title="SDK">
    **For direct integration into your Python applications:**

    <Tabs>
      <Tab title="Function Arguments">
        ```python theme={null}
        import openlit

        openlit.init(
          otlp_endpoint="http://localhost:4318"
        )
        ```

        <Note>The DataDog Agent handles authentication and forwarding to DataDog. No API key needed in the application configuration.</Note>
      </Tab>

      <Tab title="Environment Variables">
        ```python theme={null}
        import openlit

        openlit.init()
        ```

        Set these environment variables:

        ```shell theme={null}
        export OTEL_EXPORTER_OTLP_ENDPOINT="http://localhost:4318"
        ```

        <Note>The DataDog Agent handles authentication and forwarding to DataDog. No API key needed in the application configuration.</Note>
      </Tab>
    </Tabs>

    Refer to the OpenLIT [Python SDK repository](https://github.com/openlit/openlit/tree/main/sdk/python) for more advanced configurations and use cases.
  </Tab>

  <Tab title="CLI">
    **For zero-code auto-instrumentation via command line:**

    <Tabs>
      <Tab title="CLI Arguments">
        ```shell theme={null}
        # Using CLI arguments
        openlit-instrument \
          --otlp-endpoint "http://localhost:4318" \
          --service-name "my-ai-service" \
          --deployment-environment "production" \
          python app.py
        ```

        <Note>The DataDog Agent handles authentication and forwarding to DataDog. No API key needed in the CLI configuration.</Note>
      </Tab>

      <Tab title="Environment Variables">
        ```shell theme={null}
        # Set environment variables (takes precedence over CLI args)
        export OTEL_EXPORTER_OTLP_ENDPOINT="http://localhost:4318"
        export OTEL_SERVICE_NAME="my-ai-service"
        export OTEL_DEPLOYMENT_ENVIRONMENT="production"

        # Run your application
        openlit-instrument python app.py
        ```

        <Note>The DataDog Agent handles authentication and forwarding to DataDog. No API key needed in the CLI configuration.</Note>
      </Tab>
    </Tabs>

    Refer to the OpenLIT [Python SDK repository](https://github.com/openlit/openlit/tree/main/sdk/python) for more advanced configurations and use cases.
  </Tab>
</Tabs>

### 3. Exploring Telemetry in DataDog

Once your AI application is sending telemetry data to DataDog, you can explore and analyze it using DataDog's powerful observability features:

#### Software Catalog

View all your AI services and their connections:

* Go to **APM** → **Software Catalog**
* Select **Map** to see how services are connected
* Change **Map layout** to **Cluster** or **Flow** for different views
* Select **Catalog** view, then click a service for performance summary

#### Trace Explorer

Explore traces from your AI applications:

* Navigate to **Performance** → **Setup Guidance** → **View Traces**
* Select an indexed span to view full trace details
* View correlated data across tabs:
  * Infrastructure metrics for services with Host Metrics
  * Runtime metrics for implemented services
  * Log entries correlated with traces
  * Span links connected to traces

<Note>
  After your OpenLIT-instrumented AI application starts sending data, it may take a few minutes for traces and metrics to appear in DataDog. The built-in telemetry generation will begin automatically once your application processes AI requests.
</Note>
