RousselTMLEARNING

TP · OpenObserve: from discovery to expertise

Lab: Collect traces with the OpenTelemetry Collector with correction

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. 1. Configure the Collector

    Why? The exporter appends /v1/traces itself: only set the base.

    Write collector.yaml with the otlphttp exporter 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. 2. Add the Collector to the stack

    Why? The password must not be written in the Collector configuration.

    Add the collector service 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. 3. Generate traces

    Why? telemetrygen stands in for an instrumented application.

    Start the stack and send 20 traces to the Collector.
    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=paiement
  4. 4. Check

    Why? The stream-name header selected the applis stream.

    Query the stream of type 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

  • ⏱ Estimated time : ≈ 35 min

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

💬 Ask a question

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

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!