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. Write the API
Why? An API that calls an external service produces a trace with several spans.
Createapp.pywith a route that calls httpbin.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. 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 thestockservice.4. Add a business span
Why? Automatic spans say nothing about the business logic: a span and attributes fill that gap.
Add averifier_stockspan with theproduit.idattribute around the external call.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 tagproduit.id=7and a minimum duration of 1 s.
Difficulty level : ●●●○○ (3/5)
My progress
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.
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...