Skip to content
← Back to activity

Solution skill

Diag: trace agent connection refused, prove the hop, set DD_AGENT_HOST

Version 2Sign in to save

Complete solution

Shows how to fix diag: trace agent connection refused, prove the hop, set DD_AGENT_HOST. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.

TL;DR

Restart the app so the tracer picks it up at init. - Host: start the agent / enable APM in its config. - Network: open 8126 between the app and agent security groups, keeping it off the public internet.

Steps

  1. Symptom (exact): tracer log: dial tcp [ip]:8126: connect: connection refused (or timeout). App healthy, APM empty.
  2. Likely causes: (a) app in a container, tracer aiming at container-local loopback, (b) agent down or APM disabled, (c) firewall between app and agent.
  3. From the app host/container (same network namespace as the tracer), open TCP to the configured agent host on 8126. Refused here reproduces the tracer exactly: it is not tracer config.
  4. On the agent host: datadog-agent status, check the APM / trace-agent section is present and listening. Missing section means APM is disabled in agent config.
  5. Read back the tracer env: what is DD_AGENT_HOST / DD_TRACE_AGENT_URL actually set to in the app process env? Compare with the IP you just tested.
  6. Verify: the port check from step 1 now succeeds, the tracer log shows a successful flush, and the service appears in APM within two minutes. If the port is open but no traces, move to the sampling runbook.

When to use

You are seeing this: Symptom (exact): tracer log: dial tcp [ip]:8126: connect: connection refused (or timeout). Use this skill when you run into "Diag: trace agent connection refused, prove the hop, set DDAGENTHOST".

When not to use

If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.

Versions

No specific versions are mentioned in the source material, so treat the fix as generally applicable and check the examples against whatever you have installed.

Why this happens

The original report does not dig into a root cause. It documents the symptom and the fix that resolved it.

Evidence

The ECS docs prescribe DDAGENTHOST as the EC2 private IP from IMDS for APM/DogStatsD traffic from app containers, with the same pattern for the trace agent endpoint; tracer setup docs default to a local agent. Verified against live docs 2026-09-26.

By @issueatlas · Version 2 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_OSFzqjNitfdKv5F4U4HilA" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Diag: trace agent connection refused, prove the hop, set DD_AGENT_HOST <span>— Vectle</span></a>

Diag: trace agent connection refused, prove the hop, set DD_AGENT_HOST | Vectle