---
title: "Datadog"
description: "Connect Datadog so the SRE Agent can fix production errors and Baz can monitor merged changes."
canonical: "https://baz.ai/docs/integrations/observability/datadog"
---

# Datadog

Connect Datadog so the SRE Agent can fix production errors and Baz can monitor merged changes.

Connect Datadog to let Baz act on production signals. The [SRE Agent](/docs/agents/maintain/sre-agent) reads error tracking issues, traces and logs, finds the root cause in your code, and opens fix pull requests. Datadog also powers post-deploy monitoring for pull requests you label for it.

## What Baz uses Datadog for

The SRE Agent reads error tracking issues, APM traces, and logs for the services mapped to your repositories, once a day. For post-deploy monitoring, add the `baz-monitor-in-prod` label to a pull request: after it merges, Baz compares Datadog signals before and after the deploy and reports the result.

## Before you start

You need a Datadog API key and an application key with `error_tracking_read`, `apm_read`, and `logs_read_data`, and the SRE Agent turned on in **Software Factory → Maintain**, plus write access and a [sandbox](/docs/integrations/sandbox) on the repositories it should fix.

## Connect Datadog

<Steps>
  <Step title="Open the Datadog integration">
    Go to **Settings → Integrations**, select **Observability**, then **Datadog**, and select **Configure**.
  </Step>
  <Step title="Fill in the form">
    In **Create a new Datadog integration**, enter **Datadog Org Name**, choose your **Datadog site URL** (`datadoghq.com`, `us3.datadoghq.com`, `us5.datadoghq.com`, `datadoghq.eu` or `ap1.datadoghq.com`), and paste the **App key** and **API key**. Select **Submit**.
  </Step>
  <Step title="Let Baz validate access">
    Baz tests APM, logs and error tracking access. If a permission is missing, the error names it.
  </Step>
  <Step title="Map services to repositories">
    Open the integration's menu, select **SRE Settings**, and add rows under **Service to repository mapping**. Under **Environments**, limit analysis to environments such as `prod`.
  </Step>
</Steps>

You can connect more than one Datadog organization. Each has its own SRE settings.

## Troubleshooting

<Accordion>
  <AccordionItem title="Missing Datadog permissions">
    Add the scopes named in the error to the application key, then save the integration again.
  </AccordionItem>
  <AccordionItem title="No SRE pull requests">
    Check that the SRE Agent is on, the service maps to a repository, and that repository has write access and a sandbox.
  </AccordionItem>
</Accordion>

## Related

<CardGroup cols={2}>
  <Card title="SRE Agent" href="/docs/agents/maintain/sre-agent" icon="siren">
    How production errors become fix pull requests.
  </Card>
  <Card title="Sandbox" href="/docs/integrations/sandbox" icon="box">
    Where the Fixer builds and tests SRE fixes.
  </Card>
</CardGroup>
