RousselTMLEARNING

TP · Datadog: from discovery to expertise

Lab: Python APM and log-trace correlation

What you will learn in this TP
  • Instrument with ddtrace
  • Read the service page
  • Correlate logs and traces

Introduction #

What you will learn in this section
  • Instrument with ddtrace
  • Read the service page
  • Correlate logs and traces

Context. Developers want to go from an error log to the full trace of the request, and vice versa.

Prerequisites: Lab 1 completed, Python 3  ·  Estimated time: 45 min

Linked traces and logs.

Hands-on #

Guided steps, with their solutions.

  1. 1. Write the API

    Why? A slow route that sometimes fails produces interesting traces.

    Create app.py.
  2. 2. Run with ddtrace

    Why? ddtrace-run instruments Flask and injects the IDs into the logs.

    Install ddtrace and run the API with unified tagging.
  3. 3. Generate traffic

    Why? You need requests, including errors, to populate the service page.

    Send 300 requests.
  4. 4. Read the service page

    Why? RED metrics and deployments appear automatically.

    Open APM > Services > paiement-api. Note the error rate and the p95 latency, then open an error trace.
  5. 5. Correlate

    Why? The injected IDs link the two signals.

    Send app.log to Datadog (agent log configuration on this file, service:paiement-api), then go from a trace to its logs and from an error log to its trace.

Difficulty level : ●●●○○ (3/5)

My progress

  • ⏱ Estimated time : ≈ 45 min

Sign in to track your progress and take notes. Sign in

✉️ Ask a question

Recommended Articles

APM Datadog et OpenTelemetry : traces, services et corrélation avec les logs

Instrumenter ses applications pour l'APM Datadog (dd-trace, instrumentation en une étape, OpenTel...

Understanding the concept of score

The concept of score allows Elasticsearch to rank your documents by relevance during a search.

Understanding the Elastic Common Schema (ECS)

As always in our consulting engagements, we recommend that companies harmonise and standardise: k...

License consumption types

Understand the evolution of billing in Dynatrace: the difference between the old licensing model ...

Grafana Alloy: The importance of Self-Monitoring

Discover why and how to configure Grafana Alloy so that it monitors itself, collecting its own lo...

Grafana Alloy: Understanding and exploiting the User Interface (UI)

Discover how to enable, secure, and use Grafana Alloy's built-in web interface to visualize your ...

Grafana Alloy: Introduction and Architecture

Discover the fundamental concepts of Grafana Alloy, the transition from the static Agent to Alloy...

Grafana Alloy: Syntax and Configuration (Alloy Language: River)

As part of a Grafana training or observability training, master the declarative syntax of Grafana...

Grafana Alloy: Metrics Collection (Prometheus & Ecosystem)

Learn how to configure Grafana Alloy to collect, transform, and forward metrics using the Prometh...