Datadog APM Distributed Tracing Configuration Guide

When a cart request takes seconds instead of milliseconds, finding the culprit across microservices turns into a detective story. We configure Datadog APM for distributed tracing so you can see the path of every request and quickly spot bottlenecks. Our team delivers the project turnkey—from agent installation to Unified Service Tagging and adaptive sampling setup—ensuring stable operation and ongoing support.

Our competencies:

Frequently Asked Questions

Latest works

  • Development of a web application for FEEDME
    Development of a web application for FEEDME
    1365
  • Development of an online store for the company FURNORO
    Development of an online store for the company FURNORO
    1330
  • B2B Advance company logo design
    B2B Advance company logo design
    776
  • Development of a web application for Enviok
    Development of a web application for Enviok
    1077
  • AIDER company logo development
    AIDER company logo development
    1022
  • CRM development for Chasseurs
    CRM development for Chasseurs
    1113

Imagine: a cart request takes 2 seconds instead of 200 ms. Without tracing, you spend a day cycling through services. Datadog APM shows that 80% of the time is spent on inventory-service calls — and immediately indicates a suboptimal SQL query. Correlating traces with logs reveals the exact error without switching systems, saving up to 4 hours per day on debugging.

We configure Datadog APM for distributed tracing in microservice architectures. Without proper tracing, every 500-millisecond spike turns into a detective story. Datadog offers tracing as part of a unified platform — no separate Jaeger collector or Elasticsearch needed. The Datadog agent receives traces and sends them to the cloud, where they automatically correlate with metrics, logs, and profiles. This is the main advantage — and the main limitation: you depend on SaaS and pay for data volume. But for 80% of companies, this pays off by reducing MTTR by 60% and saving up to $2000 per month on logging infrastructure for 10 microservices.

How Datadog APM Simplifies Microservice Tracing

The setup is straightforward: dd-agent as a DaemonSet in Kubernetes receives traces from applications on localhost:8126 (or via Unix socket), aggregates them, and sends them to Datadog. Applications are instrumented via the dd-trace library. Install the Datadog Agent in Kubernetes using Helm:

helm repo add datadog https://helm.datadoghq.com
helm install datadog datadog/datadog \
  --set datadog.apiKey=${DD_API_KEY} \
  --set datadog.apm.portEnabled=true \
  --set agents.containers.agent.env[0].name=DD_APM_ENABLED \
  --set agents.containers.agent.env[0].value=true

The application needs to know the agent address. Use Downward API:

env:
  - name: DD_AGENT_HOST
    valueFrom:
      fieldRef:
        fieldPath: status.hostIP
  - name: DD_TRACE_AGENT_PORT
    value: "8126"
  - name: DD_SERVICE
    value: "product-service"
  - name: DD_ENV
    value: "production"
  - name: DD_VERSION
    valueFrom:
      fieldRef:
        fieldPath: metadata.labels['tags.datadoghq.com/version']

Installation takes 15 minutes for one cluster. The agent automatically discovers services via Service Discovery and starts receiving traces.

Why Unified Service Tagging is Critical for Correlation

Unified Service Tagging is the foundation for correlation. Three tags — env, service, version — must be consistent across metrics, logs, and traces. Then Datadog can automatically correlate a version deployment with changes in error rate in traces. The best way to set tags is via labels on Kubernetes Pods:

---
labels:
  tags.datadoghq.com/env: production
  tags.datadoghq.com/service: product-service
  tags.datadoghq.com/version: "1.4.2"
---

The Datadog Agent reads these labels and automatically applies them to traces — no need to instrument manually. This ensures that when a new version is deployed, the Service Map immediately shows changes in behavior.

Instrumentation: Auto vs Manual

For most frameworks, Datadog provides auto-instrumentation: just add the library, and it patches standard HTTP, DB, and queue clients. Example for Node.js:

// Must be the first import
const tracer = require('dd-trace').init({
  service: 'product-service',
  env: process.env.DD_ENV,
  version: process.env.DD_VERSION,
  logInjection: true,
});

logInjection: true is mandatory. Without it, log-to-trace correlation won't work. Auto-instrumentation covers 20+ frameworks, including Express, Django, Spring Boot, and takes 5-10 minutes per service.

Criterion Auto-instrumentation Manual instrumentation
Setup time Minutes Hours
Coverage HTTP, DB, queues (standard clients) Any (custom spans)
Flexibility Limited to standard frameworks Full control
Errors Automatic Requires error handling code
Recommendation For most projects For non-standard protocols

Service Map and APM Metrics

Datadog automatically builds a Service Map from traces — a dependency graph with latency and error rate on each edge. This works without additional configuration and updates every 5 seconds. APM Metrics (trace.http.request.hits, trace.http.request.errors, trace.http.request.duration) are generated automatically with service, resource, and HTTP status tags. You can build SLOs directly in Datadog without writing Prometheus rules. Metric retention is 15 months, traces retention is 30 days (default).

Comparison: Datadog APM vs OpenTelemetry

Criterion Datadog APM OpenTelemetry (Jaeger)
Infrastructure SaaS, no storage needed Own backend required (Jaeger, Tempo)
Metric/log correlation Built-in (all in one platform) Separate tools
Auto-instrumentation Built-in for 20+ frameworks Via SDK, requires configuration
Sampling Adaptive (automatic) Head-based, needs setup
Cost Subscription based on data volume Free, but infrastructure costs

Datadog APM is 3-5 times faster to implement than a self-built OpenTelemetry + Jaeger + Prometheus stack. It reduces mean time to recovery (MTTR) by 60% and saves up to $2000 per month on logging infrastructure through correlation.

Adaptive Sampling and Configuration

Datadog uses Adaptive Sampling on the agent side: the agent decides what percentage of traces to send based on current volume. Manual override via DD_TRACE_SAMPLE_RATE sets a fixed fraction (0.0–1.0). For error traces, Datadog always keeps 100% — this is not configurable. We recommend leaving adaptive mode: it provides good coverage without exceeding budget. Contact us for an audit of your tracing system — we will analyze current volume and optimize sampling.

Common Setup MistakesA frequent issue is missing the version tag, causing the Service Map not to show changes upon deployment. The second is forgetting the logInjection: true variable, which breaks trace-to-log correlation. The third is using the wrong agent port: default is 8126, but if the agent is configured for Unix socket, the path must be specified.

Our Process

Our turnkey Datadog APM setup includes the following stages:

  • Analytics: audit of current architecture, identification of key services, estimation of trace volume (typically 2-3 days).
  • Design: UST tagging scheme, sampling strategy, integration with CI/CD for automatic version tagging.
  • Implementation: installation of dd-agent via Helm, instrumentation of services, log correlation setup (2-4 days for 10 services).
  • Testing: verification of end-to-end traces on dev environment, SLO validation, load testing.
  • Deployment: rollout to production, monitoring of APM metrics, alert configuration.

Timeline and Delivery

Basic installation: dd-agent + auto-instrumentation for 3-5 services takes 2-3 days. This includes UST tags, log correlation, Service SLOs in Datadog, and documentation. For 10+ services, it takes 5-7 days. We can assess your project — send us a description of your architecture.

What's Included

  • Installation and configuration of Datadog Agent in Kubernetes (via Helm).
  • Microservice instrumentation (auto or manual).
  • Unified Service Tagging setup.
  • Log-to-trace correlation (log injection).
  • Creation of Service SLOs based on APM Metrics.
  • Documentation and team training.

Our certified engineers have more than 5 years of experience with Datadog and Kubernetes, having completed 50+ observability projects. We guarantee an SLA on implementation — turnkey within the agreed timeframe. Request a consultation to discuss details. Learn more about distributed tracing.