# Use BugTape with Datadog

If your app already runs Datadog, BugTape links each issue to the matching Datadog trace or RUM session. You keep Datadog for traces, logs and metrics. BugTape keeps the grouped issue, the people it hit and the evidence to fix it.

BugTape never loads, starts or configures Datadog. It only reads ids that Datadog has already created in your app.

## What is linked

| Where the report comes from | What BugTape reads | Link in the issue |
|---|---|---|
| Python, with `ddtrace` running | Active trace id and span id, plus `DD_SERVICE` and `DD_ENV` | Open trace in Datadog |
| Node.js, with `dd-trace` running | Active trace id and span id, plus `DD_SERVICE` and `DD_ENV` | Open trace in Datadog |
| Browser, with Datadog RUM on the page | RUM session id, view id and application id | Open RUM session in Datadog |
| Any client over HTTP | `metadata.datadog` that you send yourself | Trace or RUM session |

Only ids are read. The browser SDK does not read the RUM view URL or name. In strict privacy mode the ids are still sent, because they carry no page text.

Python and Node.js trace ids are sent as the lower 64 bits in decimal, the form Datadog's trace view accepts, also when 128-bit trace ids are on.

## Turn it on

1. Install BugTape next to Datadog: the [browser SDK](/docs/quickstart/), the [Python SDK](/docs/python/) or the [Node.js SDK](/docs/node/). Nothing else changes in your code.
2. In the console, open **Settings → Integrations → Datadog** and pick your Datadog site, for example `datadoghq.com` (US1) or `datadoghq.eu` (EU). Admins and managers can change it.
3. Open an issue whose report carried a Datadog id. The **Details** card shows **Open trace in Datadog** or **Open RUM session in Datadog**.

Until a site is set, the Details card shows the id and a link to the setting.

Over the API, `GET /v1/projects/:id/datadog` returns the site and `PUT` with `{"site": "datadoghq.eu"}` sets it. Both need a signed-in console session; agent tokens are refused, and `PUT` needs an admin or manager. `site` is one of `datadoghq.com`, `us3.datadoghq.com`, `us5.datadoghq.com`, `datadoghq.eu`, `ap1.datadoghq.com`, `ap2.datadoghq.com`, `ddog-gov.com`, or `null` to turn links off.

## Send ids yourself

Any client can attach ids in the report metadata:

```json
{
  "title": "TimeoutError: rates service did not answer in 8s",
  "metadata": { "datadog": { "trace_id": "5124361204338292431", "span_id": "881", "service": "rates", "env": "prod" } }
}
```

Ids are letters, digits and dashes, up to 64 characters. Anything else is not linked.

## See also

- [Python](/docs/python/)
- [Node.js](/docs/node/)
- [Keep Datadog, add BugTape](/docs/beat-datadog-agent-loop/): where the agent fix loop fits next to APM.
