Skip to content

Datadog APM Trace Not Visible Fix

DodaTech Updated 2026-06-24 3 min read

In this tutorial, you'll learn about Datadog APM Trace Not Visible Fix. We cover key concepts, practical examples, and best practices.

Your application has Datadog APM configured but no traces appear in the APM dashboard — the tracing library isn't instrumenting correctly, APM isn't enabled in the agent, or traces are being dropped by sampling.

The Problem

Datadog APM > Traces
Status: No traces in the last hour

The application is running with the Datadog tracing library, but no traces are being sent. The APM endpoint might not be enabled in the agent configuration.

Step-by-Step Fix

1. Enable APM in the Datadog Agent

# /etc/datadog-agent/datadog.yaml
apm_config:
  enabled: true
  receiver_port: 8126
  env: production
sudo systemctl restart datadog-agent

2. Verify APM is receiving traces

sudo datadog-agent status | grep -A 20 "APM"
==========
APM Agent
==========
  Status: Running
  Receiver: localhost:8126
  Received traces: 0
  Rejected traces: 0

If Received traces: 0, the tracing library isn't sending data to the agent.

3. Configure the tracing library

# Python (ddtrace)
from ddtrace import patch_all
patch_all()

# Or instrument specific libraries
from ddtrace import patch
patch(requests=True, flask=True, redis=True)
// Node.js
const tracer = require('dd-trace').init({
  service: 'myapp',
  env: 'production'
});
# Environment variables
export DD_TRACE_ENABLED=true
export DD_AGENT_HOST=localhost
export DD_TRACE_AGENT_PORT=8126

4. Check firewall and network for port 8126

# From the application host
nc -zv localhost 8126
curl -v http://localhost:8126/

5. Adjust sampling rates

# Python: set head-based sampling
from ddtrace import config
config._sampling_rate = 1.0  # 100% sampling for testing
# Agent configuration for trace intake
apm_config:
  env: production
  max_traces_per_second: 100
  errors_per_second: 100

6. Use DD_TRACE_DEBUG for diagnostics

export DD_TRACE_DEBUG=true

Expected output:

datadog-agent status | grep -A 20 "APM"
APM Agent:
  Status: Running
  Received traces: 1234
  Rejected traces: 0
  Traces sent to backend: 1234

Prevention Tips

  • Enable APM in <a href="/devops/monitoring-tools/">datadog</a>.yaml with apm_config.enabled: true
  • Verify port 8126 is open between application and agent
  • Use environment variables for consistent tracing configuration
  • Set DD_TRACE_DEBUG=true temporarily for diagnostics
  • Monitor trace ingestion rate in Datadog's APM dashboard

Common Mistakes with apm trace

  1. Using head and tail instead of pattern matching, causing runtime errors on empty lists
  2. Forgetting that lazy evaluation defers computation until the value is forced, causing space leaks with unevaluated thunks
  3. Using return to exit a function early instead of wrapping a pure value in the monad

These mistakes appear frequently in real-world DATADOG code. DodaTech's contributors have identified these patterns through analysis of open-source projects and production systems.

Practice Exercise

Write a pure function that safely divides two integers using Maybe, then test it with edge cases like division by zero and negative numbers.

This exercise reinforces the concepts covered in this guide. Try implementing it before checking online solutions.

FAQ

### Why does Datadog APM show no traces even after configuration?

Check these in order: 1) <a href="/devops/monitoring-tools/">datadog</a>-agent status shows APM running. 2) The tracing library is installed and initialized. 3) Port 8126 is accessible. 4) Received traces increases when you make requests. 5) The service name matches a service in Datadog. If all pass, check sampling rates.

How do I send traces from a Docker container to the Datadog Agent?

Use Docker networking: set DD_AGENT_HOST to the host's IP or Docker DNS name. For Docker Compose, use DD_AGENT_HOST: <a href="/devops/monitoring-tools/">datadog</a>-agent (service name). Set DD_TRACE_AGENT_PORT: 8126. The agent must have port 8126 exposed.

What's the default trace sampling rate in Datadog?

Datadog's default head-based sampling rate is 100% (1.0). However, the backend applies its own tail-based sampling for storage. You set ingestion sampling with DD_TRACE_SAMPLING_RULES. For high-traffic services, use a lower sampling rate to reduce costs.

Built by the developers of DodaTech

Doda Browser, DodaZIP & Durga Antivirus Pro