Wiring CircleCI into Datadog: Pipeline Visibility Without the Guesswork
Most teams instrument their production services in Datadog and stop. Their CI pipeline runs blind: they know a build failed, but not why it was slow yesterday, which job spends the most time queued, or whether that flaky test has gotten worse over two weeks. Connecting CircleCI to Datadog takes thirty minutes of configuration and delivers the same observability you already expect from your services.
What You Actually Get
Before touching config, know exactly what lands in Datadog once the integration is live.
CI Visibility shows pipeline executions as traces in Datadog APM. Every pipeline run, every workflow, every job becomes a span. Filter by branch, author, status, or tag, then drill into individual job durations and wait times the same way you drill into service calls.
Metrics flow into your existing dashboards:
ci.pipeline.run.duration— wall-clock time from trigger to completionci.job.run.queue_time— time spent waiting for a runnerci.job.run.duration— actual execution timeci.pipeline.run.error_rate— failures per pipeline
Log forwarding from jobs puts build output in the same interface where you investigate production incidents. No more tab-switching between CircleCI’s UI and your observability stack.
The Two-Part Setup
The integration has two independent pieces. You need both.
Part 1: CI Visibility via the Datadog Agent
Datadog’s CI Visibility ingests pipeline telemetry through a CircleCI webhook. CircleCI pushes pipeline events — started, succeeded, failed — to a Datadog endpoint, and Datadog assembles them into traces.
Step 1: Create a Datadog API key scoped to CI Visibility. Navigate to Organization Settings → API Keys and create a key. Copy it; you will not see it again.
Step 2: Add the key to CircleCI as an environment variable. In your CircleCI project settings, go to Environment Variables and add:
DATADOG_API_KEY=<your key>Set it at the organization level with a context if multiple projects need it:
workflows: build: jobs: - test: context: datadog-observabilityStep 3: Add the Datadog orb to your CircleCI config:
version: 2.1
orbs: datadog: datadog/datadog@1
jobs: test: docker: - image: cimg/python:3.12 steps: - checkout - datadog/initialize - run: name: Run tests command: pytest --junit-xml=test-results/results.xml - datadog/upload_test_results: path: test-resultsdatadog/initialize starts the Datadog Agent as a background process inside the job container. datadog/upload_test_results ships your JUnit XML output to Datadog so individual test runs appear in Tests under CI Visibility.
Part 2: Webhook for Pipeline-Level Telemetry
The orb instruments jobs. The webhook instruments pipelines and workflows — the outer spans that wrap your jobs. Without it, you get job-level data with no pipeline context to group it under.
In CircleCI, go to Organization Settings → Webhooks and create a new webhook:
| Field | Value |
|---|---|
| Receiver URL | https://webhook-intake.datadoghq.com/api/v2/webhook/?dd-api-key=<YOUR_API_KEY> |
| Secret token | any random string (store it) |
| Events | Pipeline completed, Workflow completed |
Datadog verifies the HMAC signature on every payload. Use a real secret — not an empty string.
What to Monitor First
Once data flows in, three dashboards pay off immediately.
Pipeline duration by branch. Create a timeseries widget on ci.pipeline.run.duration grouped by @git.branch. Your main branch should be fastest; feature branches that drift significantly indicate test pollution or missing caching. Set an alert threshold at 1.5× your main branch’s P95.
Queue time as a capacity signal. High ci.job.run.queue_time means your runner pool is undersized for your team’s commit rate. If queue time exceeds 2 minutes regularly, you are paying for developer attention while machines catch up. Add a monitor on the 15-minute average; page at 5 minutes.
Flaky test detection. Under CI Visibility → Tests, filter by Flaky status. Datadog identifies tests that pass and fail across runs on the same commit. A flaky test rate above 1% erodes your team’s trust in CI faster than almost any other factor. Treat the list as a bug backlog.
One Pattern That Makes the Diff Reviewable
Add the orb and webhook changes in separate commits. The orb change touches .circleci/config.yml and affects every job; the webhook change happens entirely in CircleCI’s UI and leaves no code footprint. Reviewers who see both in one commit conflate infrastructure configuration with build configuration and approve without reading either carefully. Split them.
The Payoff
A pipeline you can observe is a pipeline you can improve. With CircleCI data in Datadog, you can answer in under a minute: which job is slowest, whether it is getting worse, and whether the slowdown correlates with a recent change. That is the same question you ask about a service with high latency — and now you have the same tools to answer it.