The correction is integrated into the TP (See the green boxes)
What you will learn in this TP
- Configure the otlphttp exporter
- Generate traces
- Query them
Introduction #
What you will learn in this section
- Configure the otlphttp exporter
- Generate traces
- Query them
Context. Your applications are instrumented with OpenTelemetry. You route them through a Collector, without tying them directly to the platform.
Prerequisites: the previous lab · Estimated time: 35 min
An end-to-end trace flow.Setup #
Guided steps, with their solution.
1. Configure the Collector
Why? The exporter appends
Write/v1/tracesitself: only set the base.collector.yamlwith theotlphttpexporter and the authentication header.See the correction
receivers: otlp: protocols: grpc: endpoint: 0.0.0.0:4317 http: endpoint: 0.0.0.0:4318 processors: batch: exporters: otlphttp/openobserve: endpoint: http://openobserve:5080/api/default headers: Authorization: "Basic ${env:O2_AUTH}" stream-name: applis service: pipelines: logs: receivers: [otlp] processors: [batch] exporters: [otlphttp/openobserve] metrics: receivers: [otlp] processors: [batch] exporters: [otlphttp/openobserve] traces: receivers: [otlp] processors: [batch] exporters: [otlphttp/openobserve]2. Add the Collector to the stack
Why? The password must not be written in the Collector configuration.
Add thecollectorservice to the Compose file.See the correction
services: openobserve: image: o2cr.ai/openobserve/openobserve:v1.1.2 ports: - "5080:5080" environment: ZO_DATA_DIR: /data ZO_ROOT_USER_EMAIL: root@example.com ZO_ROOT_USER_PASSWORD: Complexpass#123 volumes: - o2-data:/data collector: image: otel/opentelemetry-collector-contrib:latest command: ["--config=/etc/otelcol/config.yaml"] environment: O2_AUTH: ${O2_AUTH} volumes: - ./collector.yaml:/etc/otelcol/config.yaml:ro depends_on: [openobserve] volumes: o2-data:3. Generate traces
Why?
Start the stack and send 20 traces to the Collector.telemetrygenstands in for an instrumented application.See the correction
export O2_AUTH=$(printf 'root@example.com:Complexpass#123' | base64) docker compose up -d docker run --rm --network "$(basename "$PWD")_default" \ ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen:latest \ traces --otlp-insecure --otlp-endpoint=collector:4317 --traces 20 --service=paiement4. Check
Why? The
Query the stream of typestream-nameheader selected theapplisstream.traces, then open the Traces menu in the UI.See the correction
NOW=$(date +%s) curl -s -u 'root@example.com:Complexpass#123' -H 'Content-Type: application/json' \ 'http://localhost:5080/api/default/_search?type=traces' \ -d "{\"query\":{\"sql\":\"SELECT service_name, operation_name, duration FROM applis\", \"start_time\":$(( (NOW-3600)*1000000 )),\"end_time\":$(( (NOW+60)*1000000 )),\"from\":0,\"size\":3}}" | jq .hits
Difficulty level : ●●○○○ (2/5)
My progress
Sign in to track your progress and take notes. Sign in
Recommended Articles
Sending logs, metrics and traces to OpenObserve
OpenObserve receiving endpoints: JSON, bulk, OTLP with the OpenTelemetry Collector, Prometheus re...
Les profils, le quatrième signal d'OpenTelemetry : profilage continu et corrélation avec les traces
Comprendre le nouveau signal profile d'OpenTelemetry : profilage continu, flame graphs, modèle de...
OpenTelemetry et Dynatrace : OTLP, collecteur et instrumentation
Intégrer OpenTelemetry à Dynatrace : endpoint OTLP et jetons, Dynatrace OTel Collector, traces, m...
Corréler traces, métriques, logs et profils avec OpenTelemetry
Relier les quatre signaux pour diagnostiquer vite : ressource commune, trace_id dans les logs, ex...
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...
OpenObserve: architecture and concepts
Understanding OpenObserve: Parquet storage, deployment modes, roles (router, ingester, querier, c...
Exploring data in OpenObserve: SQL, PromQL and VRL
Search with SQL, query metrics with PromQL, optimize a stream (indexes, partitions, retention) an...