Datadog APM Trace Not Visible Fix
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>.yamlwithapm_config.enabled: true - Verify port 8126 is open between application and agent
- Use environment variables for consistent tracing configuration
- Set
DD_TRACE_DEBUG=truetemporarily for diagnostics - Monitor trace ingestion rate in Datadog's APM dashboard
Common Mistakes with apm trace
- Using
headandtailinstead of pattern matching, causing runtime errors on empty lists - Forgetting that lazy evaluation defers computation until the value is forced, causing space leaks with unevaluated thunks
- Using
returnto 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
Built by the developers of DodaTech
Doda Browser, DodaZIP & Durga Antivirus Pro