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
Recommended Articles
Instrumenter ses applications pour Jaeger avec OpenTelemetry
Envoyer des traces à Jaeger avec OpenTelemetry : auto-instrumentation (Java, Python, Node.js), SD...
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...