What you will learn in this TP
- Install the Operator
- Declare Collector and Instrumentation
- Instrument through annotation
Introduction #
What you will learn in this section
- Install the Operator
- Declare Collector and Instrumentation
- Instrument through annotation
Context. The platform team wants every cluster application to produce traces without each team changing its images. You validate the Operator approach.
Prerequisites: Docker, kubectl and kind · Estimated time: 50 min
An application instrumented without image changes, whose spans reach an Operator-managed Collector.Hands-on #
Guided steps, with their solution.
1. Prepare the cluster
Why? The Operator uses admission webhooks whose certificates are managed by cert-manager.
Create a kind cluster, install cert-manager then the Operator, and wait until they are available.2. Declare a Collector
Why? The Collector is described as a Kubernetes resource: the Operator creates the Deployment, Service and ConfigMap.
Create ademonamespace and anOpenTelemetryCollectorresource in deployment mode with an OTLP receiver,k8sattributesand thedebugexporter.3. Declare instrumentation
Why? The Instrumentation resource centralises exporter, propagators and sampling for a whole namespace.
Create anInstrumentationresource that sends OTLP/HTTP to the Collector, with tracecontext and baggage propagators and 100% sampling.4. Instrument an application through annotation
Why? The annotation is enough: the Operator injects the Python agent at pod start, without changing the image.
Deploy a small Flask application in a standard Python image with theinstrumentation.opentelemetry.io/inject-pythonannotation, then look at the injected init container andOTEL_*variables.5. Check the spans
Why? The debug exporter prints received spans with the Kubernetes attributes added by k8sattributes.
Generate a few requests through a port-forward, then look in the Collector logs for theGET /span,service.nameandk8s.pod.name.6. Evolve and clean up
Why? Changing the Instrumentation resource only affects recreated pods: deployments must be restarted.
Set sampling to 10%, restart the deployment, check the newOTEL_TRACES_SAMPLER_ARGvalue, then delete the cluster.
Difficulty level : ●●●○○ (3/5)
My progress
Sign in to track your progress and take notes. Sign in
Recommended Articles
OpenTelemetry Collector, Grafana Alloy et Bindplane : comparer trois approches des pipelines de télémétrie
Comparatif détaillé de trois façons de gérer des pipelines de télémétrie : l'OpenTelemetry Collec...
OpenTelemetry Collector : les Processors (transformer, filtrer et protéger la télémétrie)
Maîtriser les processors du Collector OpenTelemetry : batch, memory_limiter, attributes, resource...
Les logs avec OpenTelemetry : modèle de données, appenders, corrélation et collecte
Maîtriser le signal log : modèle de données LogRecord, Logs Bridge API et appenders (Logback, Log...
Projet fil rouge : les quatre signaux de l'OpenTelemetry Demo dans la stack Grafana
Un projet fil rouge qui traverse les formations d'observabilité : déployer l'OpenTelemetry Demo, ...
OpenTelemetry et Dynatrace : OTLP, collecteur et instrumentation
Intégrer OpenTelemetry à Dynatrace : endpoint OTLP et jetons, Dynatrace OTel Collector, traces, m...
Collector OpenTelemetry : connecteurs, extensions et observabilité du Collector
Aller plus loin avec le Collector : connecteurs (spanmetrics, servicegraph, count, routing, failo...
OpenTelemetry Collector : les Exporters (envoyer la télémétrie vers les backends)
Configurer les exporters du Collector OpenTelemetry : OTLP gRPC/HTTP, Prometheus, prometheusremot...
Grafana Alloy vs OpenTelemetry Collector: Which One Should You Choose?
A detailed comparison between Grafana Alloy and the OpenTelemetry Collector. Discover the strengt...
Architecture OpenTelemetry : Comprendre les 3 niveaux
Plongée au cœur de l'architecture OpenTelemetry. Apprenez comment les données circulent de l'appl...