1. Instrumenting #
Three options.
Choosing #
| Method | Principle | When |
|---|---|---|
| Single Step Instrumentation | The agent (or operator) automatically injects the libraries when processes start | Quickly covering a whole host or cluster |
| dd-trace libraries | A library per language, started with the application | Fine control, full Datadog features |
| OpenTelemetry | OTel SDK, OTLP sent to the agent or the Collector | Vendor neutrality |
pip install ddtrace
DD_SERVICE=checkout DD_ENV=prod DD_VERSION=2.4.1 DD_LOGS_INJECTION=true DD_AGENT_HOST=localhost \
ddtrace-run gunicorn app:appOpenTelemetry to Datadog #
# datadog.yaml : l'agent reçoit l'OTLP
otlp_config:
receiver:
protocols:
grpc: { endpoint: 0.0.0.0:4317 }
http: { endpoint: 0.0.0.0:4318 }Applications instrumented with OpenTelemetry send to the agent (ports 4317/4318); the deployment.environment, service.name and service.version attributes are converted to env, service and version.
2. Using APM #
Services, traces, profiles.
Views #
| View | Usage |
|---|---|
| Software Catalog / Services | Health of each service, owners, documentation |
| Service page | Throughput, errors, latency per resource; deployments (version tag) |
| Service Map | Observed dependencies |
| Trace Explorer | Span search by attributes, analytics |
| Continuous Profiler | CPU and memory profiles linked to traces |
| Error Tracking | Errors grouped by cause |
Good to know: Trace retention relies on ingestion sampling and retention filters: not all traces are kept for 15 days, only those retained by the filters (errors, slow traces, sample).
3. Linking logs and traces #
One click from one signal to the other.
Correlation #
With DD_LOGS_INJECTION=true, the library adds dd.trace_id and dd.span_id to logs; Datadog shows the logs of a trace and the trace of a log.
2026-10-19 10:00:00 ERROR [dd.service=checkout dd.env=prod dd.version=2.4.1 dd.trace_id=5735239282836592 dd.span_id=1234567] Paiement refuséGood practice: If logs are in JSON, the dd.* attributes are recognized directly; otherwise, add them to the log format and extract them in the pipeline.My progress
Sign in to track your progress and take notes. Sign in
💬 Recent discussions about this course
- Datadog : relier traces, logs et métriques du même service✓ solved · 1 reply(ies)
Ask a question about this lesson →See all discussions about this course
Recommended Articles
Advanced Datadog APM: sampling, retention, profiler and Software Catalog
Go further with Datadog APM: ingestion control and sampling, retention filters, trace metrics, Co...
Elastic Observability: logs, infrastructure, APM and synthetics
Elastic Observability features: log exploration, infrastructure inventory with Elastic Agent and ...
Datadog on Kubernetes: Operator, Cluster Agent and Autodiscovery
Monitor Kubernetes with Datadog: the Datadog Operator and the DatadogAgent resource, Cluster Agen...
Datadog: the SaaS observability platform at a glance
What Datadog is, its products (infrastructure, logs, APM, RUM, synthetics, security), its concept...
OpenTelemetry traces in Elasticsearch and Kibana APM
Instrument applications with OpenTelemetry or EDOT SDKs, send traces to Elasticsearch, get Kibana...
Logs with OpenTelemetry: data model, appenders, correlation and collection
Master the log signal: the LogRecord data model, the Logs Bridge API and appenders (Logback, Log4...
Correlating traces, metrics, logs and profiles with OpenTelemetry
Link the four signals to diagnose quickly: shared resource, trace_id in logs, exemplars on metric...
Profiles, OpenTelemetry's fourth signal: continuous profiling and correlation with traces
Understand OpenTelemetry's new profile signal: continuous profiling, flame graphs, data model and...
OpenTelemetry and Dynatrace: OTLP, collector and instrumentation
Integrate OpenTelemetry with Dynatrace: OTLP endpoint and tokens, Dynatrace OTel Collector, trace...