> For the complete documentation index, see [llms.txt](https://docs.pagerly.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.pagerly.io/sre-ai-agent/data-sources/datadog.md).

# Datadog

## What the Agent Can Do

* Query logs by service, status, and time range
* Query metrics and create metric comparisons
* Search APM traces for latency and errors
* Check monitor status and alert history
* View dashboards and SLOs

## Setup Instructions

1. Log into your **Datadog account**
2. Go to **Organization Settings** > **API Keys**
3. Click **+ New Key**, name it `Pagerly`, and copy the key
4. Go to **Application Keys** tab, click **+ New Key**
5. **Important:** Restrict the Application Key to these scopes only:
   * `logs_read_data` — Read log data
   * `logs_read_index_data` — Read log indexes
   * `timeseries_query` — Query metrics
   * `metrics_read` — View metrics
   * `monitors_read` — View monitors
   * `dashboard_read` — View dashboards
6. For full discovery, also add:
   * `infrastructure_host_read` — View infrastructure hosts
   * `service_catalog_read` — View Service Catalog
   * `slos_read` — View SLOs
7. Copy the Application Key
8. Paste your keys and Datadog URL below

## Required Credentials

| Field               | Description                              | Example                     |
| ------------------- | ---------------------------------------- | --------------------------- |
| **API Key**         | Datadog API key                          | `your-api-key`              |
| **Application Key** | Datadog Application key with read scopes | `your-app-key`              |
| **Datadog URL**     | Your Datadog site URL                    | `https://us5.datadoghq.com` |

{% hint style="warning" %}
**Both keys are required.** The API Key authenticates requests, and the Application Key controls what data can be accessed. Always use scoped Application Keys with minimal permissions.
{% endhint %}

## Context Prompt Tips

> *"Our services use service:api-gateway tag. Production env uses env:prod. Error logs are status:error."*

## Docs

* [Datadog API Reference](https://docs.datadoghq.com/api/latest/)
