# Export telemetry to Datadog
source: https://docs.chalk.ai/docs/datadog-telemetry-export

## Send metrics, logs, and traces directly from Chalk to your Datadog account with Vector.

Use the Vector exporter in your Chalk cluster to send metrics, logs, or traces directly to Datadog.
You can enable each signal independently. If you already use a Datadog Agent to scrape Chalk,
see Legacy OpenMetrics export.

### Before you start

You need:

- Metrics Export enabled for your Chalk team
- Permission to edit telemetry settings in Chalk
- A Datadog API key and the Datadog site for your account, such as datadoghq.com or datadoghq.eu
- Access to the Datadog account where you want to verify delivery

If Exporters is missing from your telemetry settings, contact Chalk support to enable access.

### 1. Prepare your Datadog API key

Store your Datadog API key in AWS Secrets Manager in the AWS account and region used by Chalk.
Use the raw API key as the secret value, without JSON or surrounding quotation marks. Copy the
secret's full ARN, for example:

```text
arn:aws:secretsmanager:us-east-1:123456789012:secret:datadog-api-key-AbCdEf
```

Chalk needs permission to read this secret. If you need help storing the key or granting access,
ask your cloud administrator or Chalk support. Have the ARN ready for the next step.

### 2. Enable export in Chalk

- Open Cloud Clusters, select your cluster's Telemetry tab,
and open its telemetry configuration.
- In the guided form, select Vector under Telemetry Runtime. Open
Exporters → Export to Datadog.
- Set API Key Lookup Type to ARN and paste the ARN into API Key Secret ARN.
- Set API Host to your Datadog site. Enter the hostname alone, such as datadoghq.com (default)
or datadoghq.eu (EU).
- Turn on Export metrics to Datadog for metrics. To send logs or traces, enable
Export logs to Datadog or Export traces to Datadog.
- Save, review the changes, and confirm the update. Leave Telemetry enabled.

### Verify metrics

To identify metrics from this cluster, add a tag under Export to Datadog → VRL → Metrics remap VRL.
Keep any existing remap code and choose a value for your environment.

```vrl
.tags.chalk_export = "chalk-production"
```

Save and confirm the update, then run queries in that Chalk environment. In the Datadog
Metrics Catalog, filter by the tag chalk_export:chalk-production. Open a matching metric in Metrics
Explorer and confirm that it has samples from after you enabled the export.

### Verify traces

Run a traced query and open its Trace tab in Chalk.
In Datadog APM, look for spans from that query in the same time range and check the operation names.

### Send a test log

- Add the following import to an existing Python resolver file and the log call inside a resolver
you can query. Replace chalk-datadog-check-001 with a unique message for this test.

```py
from chalk.clogging import chalk_logger

# Inside your resolver:
chalk_logger.info("chalk-datadog-check-001")
```

- Deploy the updated resolver to the environment whose telemetry you
configured. Run a query that executes the resolver.
- Find the exact message in the Chalk dashboard's logs for that environment. If it is absent,
confirm that the query used the updated deployment and executed the resolver rather than reading
its result from cache.

### Find the log in Datadog

Open Logs → Explorer in your Datadog account. Select a time range covering the test, clear
unrelated filters, and search for your exact message in quotation marks:

```text
"chalk-datadog-check-001"
```

Allow time for delivery and ingestion. Open the matching log and confirm that its message and time
match the test you ran.

The export is working when the same message appears in Chalk and Datadog. You can then remove
the test log call from your resolver.

### If the log does not arrive

If you can see the test message in Chalk but not in Datadog:

- Confirm Export Logs to Datadog and Telemetry are enabled and your settings were saved.
- Confirm API Host matches the Datadog account where you are searching.
- Check that you supplied an API key for that account and stored it as a raw string.
- Check your Datadog time range, search filters, and log indexing or exclusion rules.

If the message still does not arrive, send Chalk support your Chalk environment, Datadog site,
test message, query ID, and the time of the test. Do not include your API key in the support message.

### Optional: customize exported events

After verifying delivery, use Vector Remap Language (VRL)
to change events before export. Under Exporters → Shared VRL, remaps apply to every export
destination for the corresponding signal. Under Export to Datadog → VRL, remaps apply only to
Datadog, after the shared remaps. Save and confirm your changes, then repeat the test above.





