
### Overview

There are four key use cases for the Datadog integration:

1. [Config Changes](#config-changes): Streams changes made in Statsig into Datadog, so you can identify which feature was enabled when a CPU spike or other performance degradation occurred (most widely-used integration).
2. [Event Forwarding](#events): Statsig forwards event-count totals to Datadog for monitoring your Statsig usage volumes.
3. [Datadog RUM integration](#datadog-rum-integration): Enriches Datadog RUM data with flag/experiment assignment information, allowing you to correlate product feature changes with their impact on system/performance metrics.
4. [Datadog triggers](/integrations/triggers/datadog): When an alarm fires in Datadog, it stops a Statsig feature gate.

### Connecting to Datadog

1. To create a Datadog API key, navigate to **Organization Settings** > **API Keys**. If you have the permission to create API keys, click **New Key**.

{% figure %}
![Datadog API key creation interface](/images/integrations/datadog/232632837-d1e81380-78a3-48a2-887d-72b13d541b0a.png)
{% /figure %}

2. Paste the API key in the text box at the top of the integration dialog, then select **Confirm**.

If the above steps are out of date, refer to the [Datadog documentation](https://docs.datadoghq.com/account_management/api-app-keys/#add-an-api-key-or-client-token) on how to set up API keys.

### Config changes

This integration sends Datadog Events of your choice when your project's settings change. For example, Statsig sends an Event when someone edits a Feature Gate.

These events appear in the Datadog Events Explorer.

{% figure %}
![Datadog Events Explorer interface](/images/integrations/datadog/232636042-ee5cf1d0-e9e7-4158-903b-5a447ab14575.png)
{% /figure %}

### Event totals forwarding

This integration forwards the count of Statsig SDK Events to Datadog for monitoring your project's Statsig usage. This integration also has the option to forward non-production events to Datadog.

Statsig events are mapped to Datadog metrics with listed tags as follows:

* statsig::gate\_exposure -> statsig.check\_gate.count

  * environment
  * name
  * value

* statsig::config\_exposure -> statsig.get\_config.count

  * environment

* statsig::experiment\_exposure -> statsig.get\_experiment.count

  * environment
  * group
  * name

* statsig::layer\_exposure -> statsig.get\_layer.count

  * environment
  * name

* statsig::holdout\_exposure -> statsig.get\_holdout.count
  * environment
  * name
  * value

#### Example of check\_gate metric

{% figure %}
![Datadog check_gate metric visualization](/images/integrations/datadog/232629870-e1776bd6-c63d-438d-863e-2d7a3a347eab.png)
{% /figure %}

### Datadog RUM integration

This integration requires a client-side setup. Go to the [Datadog documentation](https://docs.datadoghq.com/integrations/statsig-rum/) for setup instructions.
