RousselTMLEARNING

TP · Jaeger: distributed tracing from discovery to expertise

Lab: Instrument a Python application for Jaeger

What you will learn in this TP
  • Auto-instrument an application
  • Add spans and attributes
  • Search by tag

Introduction #

What you will learn in this section
  • Auto-instrument an application
  • Add spans and attributes
  • Search by tag

Context. Your team is developing a Python API with no tracing at all. You instrument it without rewriting the code, then add business context.

Prerequisites: previous lab completed, Python 3  ·  Estimated time: 45 min

A Python API traced end to end.

Setup #

Guided steps, with their solutions.

  1. 1. Write the API

    Why? An API that calls an external service produces a trace with several spans.

    Create app.py with a route that calls httpbin.
  2. 2. Auto-instrument

    Why? opentelemetry-instrument adds the Flask and requests instrumentations without touching the code.

    Install the OpenTelemetry distribution and run the instrumented application.
  3. 3. Generate and observe

    Why? Each call creates a server trace (Flask) with a client span (requests).

    Call the route about twenty times and open a trace from the stock service.
  4. 4. Add a business span

    Why? Automatic spans say nothing about the business logic: a span and attributes fill that gap.

    Add a verifier_stock span with the produit.id attribute around the external call.
  5. 5. Search by tag

    Why? Find the trace for a specific product, as the support team would.

    Restart the application, make more calls and search Jaeger for traces with the tag produit.id=7 and a minimum duration of 1 s.

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

My progress

  • ⏱ Estimated time : ≈ 45 min

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

💬 Questions about this lesson

No questions yet: be the first to ask for help or share your configuration.

Ask a question about this lesson →

Recommended Articles

Instrumenting applications for Jaeger with OpenTelemetry

Send traces to Jaeger with OpenTelemetry: auto-instrumentation (Java, Python, Node.js), SDK and m...

OpenTelemetry: automatic vs manual instrumentation

Understand the differences between automatic and manual instrumentation with OpenTelemetry, their...

Sending traces to Tempo: OpenTelemetry instrumentation and Alloy

Produce and route traces to Tempo: Python/Java/Node auto-instrumentation, the manual SDK, OTEL en...

Distributed tracing best practices with Jaeger

Checklist for useful tracing: OpenTelemetry instrumentation, span naming, attributes, propagation...

Distributed tracing with Jaeger: concepts and architecture

The concepts of distributed tracing (trace, span, context, propagation) and Jaeger: its history, ...

Grafana Tempo or Jaeger: which tracing backend to choose?

Detailed comparison of Grafana Tempo and Jaeger: architecture, storage, search, query language, s...

Analyzing traces in the Jaeger interface

Search for traces, read a timeline, spot the critical path, compare two traces, use the dependenc...

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...

Grafana Tempo: the distributed tracing backend at scale

Understand distributed tracing and Grafana Tempo: traces, spans, TraceID, architecture (distribut...

Support us

♥ SUPPORT US

Support RousselTM Learning

Courses, articles, labs and certificates stay free with no intrusive ads. A voluntary contribution, of any amount you choose, pays for hosting, lab environments and new content.

Contribute with PayPal Any amount · card or PayPal accountLearn more
QR code PayPal
Or scan this QR code with your phone

Thank you, every contribution counts!