> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cloudcruise.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Datadog

> Export PHI-free workflow error rates, dispatch latency, and runtime metrics and logs to Datadog

## **How to Set Up Datadog Integration**

Track CloudCruise workflow error rates, queue dispatch latency, and execution runtime directly in Datadog dashboards and monitors without sending workflow input variables, scraped outputs, or PHI.

### **Step 1: Create a Datadog API Key**

1. Log into your Datadog dashboard and navigate to **Organization Settings** → **API Keys**.
2. Click **+ New Key**, name it `CloudCruise`, and copy the key.

> [!NOTE]
>
> CloudCruise only requires a **Datadog API Key** (not an Application Key). Your key is encrypted at rest with AWS KMS and never returned after saving.

### **Step 2: Connect CloudCruise to Datadog**

1. Navigate to [Workspace Settings → Integrations](https://app.cloudcruise.com/settings/integrations).
2. Under **Monitoring**, click **Connect to Datadog**.
3. Select your **Datadog Site** (`datadoghq.com`, `us3.datadoghq.com`, `us5.datadoghq.com`, `datadoghq.eu`, `ap1.datadoghq.com`, or `ddog-gov.com`).
4. Paste your **Datadog API Key** and optionally customize the `service` and `env` tags.
5. Click **Test Connection**, then **Connect**.

***

## **What Gets Synced to Datadog?**

CloudCruise emits strictly **PHI-free** operational telemetry. Workflow `input_variables`, scraped `data`, raw free-text error messages, vault secrets, and `user_alias` are never exported.

### **Metrics**

Metrics are emitted for **all** terminal runs (`success`, `failed`, `stopped`) so error-rate denominators stay accurate regardless of log filters. If a run's start or enqueue timestamp is unavailable, the corresponding latency distribution point (`dispatch_latency_ms` or `e2e_duration_ms`) is omitted rather than recorded as `0`.

| Metric | Type | Description | Tags |
| - | - | - | - |
| `cloudcruise.runs.completed` | Count | Incremented by `1` on each terminal run | `service`, `env`, `workflow_id`, `workflow_name`, `status` (`success\|failed\|stopped`), `error_code`, `error_category`, `error_severity`, `was_recovered`, `is_dry_run` *(+ optional `user_id`)* |
| `cloudcruise.runs.retries` | Count | Retry count on runs that retried (`> 0`) | `service`, `env`, `workflow_id`, `workflow_name`, `status` |
| `cloudcruise.runs.dispatch_latency_ms` | Distribution | Queue + dispatch latency (`POST /run` → first execution start) | `service`, `env`, `workflow_id`, `workflow_name`, `priority_level` |
| `cloudcruise.runs.runtime_ms` | Distribution | Active execution runtime across attempts | `service`, `env`, `workflow_id`, `workflow_name`, `status` |
| `cloudcruise.runs.e2e_duration_ms` | Distribution | End-to-end wall-clock duration (`POST /run` → terminal completion) | `service`, `env`, `workflow_id`, `workflow_name`, `status` |

### **Example Datadog Queries**

* **Workflow error rate:**
  ```text theme={null}
  sum:cloudcruise.runs.completed{status:failed} by {workflow_name}.as_count() / sum:cloudcruise.runs.completed{*} by {workflow_name}.as_count()
  ```
* **p95 dispatch latency by workflow:**
  ```text theme={null}
  p95:cloudcruise.runs.dispatch_latency_ms{*} by {workflow_name}
  ```
* **p95 execution runtime by workflow:**
  ```text theme={null}
  p95:cloudcruise.runs.runtime_ms{status:success} by {workflow_name}
  ```

### **Structured Logs & `permissioned_user_id` Filtering**

When **Structured logs** is enabled, CloudCruise emits one PHI-free JSON log per terminal run matching your log status filters (`failed` and `stopped` enabled by default; `success` opt-in).

* Filter by user in Datadog Log Explorer using `@cloudcruise.user_id:<permissioned_user_id>`.
* Each log includes `cloudcruise.schema_version` (`1`), `cloudcruise.run_url` linking directly to the run in CloudCruise, and `dispatch_latency_ms`, `runtime_ms`, `e2e_duration_ms`, `error_code`, and `error_category`.
* **Cardinality control:** `Include user_id on metrics` is **off by default** to avoid Datadog custom-metric billing overhead; enable it only if you need per-user metric monitors.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.