# Datadog

Datadog is a cloud-based observability platform that unifies metrics, traces, logs, and real user monitoring data to provide end-to-end visibility across applications, networks, and infrastructure. This guide explains how to integrate ThousandEyes metrics with Datadog using OpenTelemetry.

For more information about sending metrics to Datadog using OpenTelemetry, see [Datadog OTLP Metrics Intake Endpoint](https://docs.datadoghq.com/opentelemetry/setup/otlp_ingest/metrics).

## Prerequisites

* You have [created a ThousandEyes test](https://docs.thousandeyes.com/product-documentation/integration-guides/opentelemetry/observability-platforms#create-a-test).
* You have generated a Datadog API key:
  1. In the Datadog platform, go to **Organization Settings > API Keys**.
  2. Click **+ New Key**.
  3. Enter a **Name** and click **Create Key**.
  4. Copy and store your API key securely.
* You have identified your Datadog OTLP endpoints. The endpoint depends on your Datadog site (`<DATADOG_SITE>`). To determine your site, see the [Datadog documentation](https://docs.datadoghq.com/getting_started/site/#access-the-datadog-site).

  Use the following endpoints:

  * For metrics: `https://otlp.<DATADOG_SITE>/v1/metrics`
    * Example: `https://otlp.datadoghq.eu/v1/metrics`
  * For logs: `https://otlp.<DATADOG_SITE>/v1/logs`
    * Example: `https://otlp.datadoghq.eu/v1/logs`

## Stream OpenTelemetry Metrics to Datadog

### Step 1: Create a Metrics Integration

#### Using the ThousandEyes UI

1. In ThousandEyes go to **Manage > Integration 1.0**.
2. Click **+New Integration** and select **OpenTelemetry Integration**.
3. Enter a **Name** for the integration.
4. Set the **Target** to **HTTP**.
5. Enter the **Endpoint URL** to send data in OTLP (OpenTelemetry Protocol) format:

   See [Datadog OTLP Metrics Intake Endpoint](https://docs.datadoghq.com/opentelemetry/setup/otlp_ingest/metrics) for the URL that corresponds to your region.
6. For **Preset Configurations**, select **Datadog**.
7. For **Auth Type**, select **Custom**.
8. Add the following **Custom Headers**:
   * `dd-api-key`: `{DD_API_KEY}`
   * `dd-otel-metric-config`: `{"resource_attributes_as_tags": true}`
9. For the OpenTelemetry **Signal**, select **Metric**.
10. For the **Data Model Version**, select **v2**.
11. Select a **test**.

    For more information on creating a test, see [General Setup Instructions](https://docs.thousandeyes.com/product-documentation/integration-guides/opentelemetry/observability-platforms#general-setup-instructions).
12. Click **Save**.

#### Using the ThousandEyes API

Create the HTTP stream programmatically:

```curl
 curl -v -XPOST https://api.thousandeyes.com/v7/stream -H "Content-Type: application/json" -H "Authorization: Bearer $BEARER_TOKEN" -d '{
  "type": "opentelemetry",
  "testMatch": [{
    "id": "281474976717575",
    "domain": "cea"
  }],
    }],
    "endpointType": "http",
    "streamEndpointUrl": "https://otlp.datadoghq.com/v1/metrics",
    "customHeaders": {
      "dd-api-key": "<DATADOG_API_KEY>",
      "dd-otel-metric-config": "{'resource_attributes_as_tags': true}"
    }
}'
```

Replace `281474976717575`, `cea`, and `<DATADOG_API_KEY>` with your actual test ID, domain (if needed), and your Datadog API key.

### ThousandEyes Dashboard in Datadog

1. Download the dashboard template: [Download ThousandEyes Dashboard Datadog dashboard template](https://github.com/thousandeyes/thousandeyes-observability-dashboards/blob/main/datadog/ThousandEyesDashboard.json)
2. In Datadog, go to **Dashboards** and click **New Dashboard > Import Dashboard JSON**.
3. Upload the downloaded JSON file.
4. Open the dashboard to visualize ThousandEyes metrics in Datadog.

![ThousandEyes Dashboard in Datadog](https://1112912342-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M4QARF6s57qxMrOHDTZ%2Fuploads%2Fgit-blob-46798a60c8c5f70c0e3c4fffe51def4e2ac518ab%2Fdatadog-dashboard.png?alt=media)

## Stream OpenTelemetry Logs to Datadog

### Step 1: Create a Logs Integration

#### Using the ThousandEyes UI

1. In ThousandEyes go to **Manage > Integration 1.0**.
2. Click **+New Integration** and select **OpenTelemetry Integration**.
3. Enter a **Name** for the integration.
4. Set the **Target** to **HTTP**.
5. Enter the **Endpoint URL** to send data in OTLP (OpenTelemetry Protocol) format:

   See [Datadog OTLP Logs Intake Endpoint](https://docs.datadoghq.com/opentelemetry/setup/otlp_ingest/logs) for the URL that corresponds to your region.
6. For **Preset Configurations**, select **Datadog**.
7. For **Auth Type**, select **Custom**.
8. Add the following **Custom Headers**:
   * `dd-api-key`: `{DD_API_KEY}`
9. For the OpenTelemetry **Signal**, select **Log**.
10. Select a **test**.

    For more information on creating a test, see [General Setup Instructions](https://docs.thousandeyes.com/product-documentation/integration-guides/opentelemetry/observability-platforms#general-setup-instructions).
11. Click **Save**.

#### Using the ThousandEyes API

Create the HTTP stream programmatically:

```curl
curl -v -XPOST https://api.thousandeyes.com/v7/stream \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $BEARER_TOKEN" \
  -d '{
    "type": "opentelemetry",
    "endpointType": "http",
    "signal": "log",
    "streamEndpointUrl": "https://otlp.datadoghq.com/v1/logs",
    "customHeaders": {
      "dd-api-key": "<DATADOG_API_KEY>"
    }
  }'
```

Replace `<DATADOG_API_KEY>` with your Datadog API key.

### Step 2: Visualize Logs in Datadog

1. In Datadog, navigate to **Logs > Explorer**.
2. Search for ThousandEyes logs and apply filters.

   For example, you can use the following query to find logs that contain ThousandEyes data: `@resource.attributes.thousandeyes.account.id: *`

![ThousandEyes Logs in Datadog](https://1112912342-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M4QARF6s57qxMrOHDTZ%2Fuploads%2Fgit-blob-a605d0ac5175b4a3e7f4bca2a8d4d889ccbb36af%2Fdatadog-logs.png?alt=media)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.thousandeyes.com/product-documentation/integration-guides/opentelemetry/observability-platforms/datadog.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
