Tutorial

A Local OpenTelemetry Sandbox With Docker Compose

Collector, Jaeger, Prometheus and a realistic data source in five minutes.

The fastest way to learn OpenTelemetry is to watch data move through a Collector into backends you can click on. This guide builds a complete local sandbox with Docker Compose: OTel Studio as the source, an OpenTelemetry Collector in the middle, Jaeger for traces and Prometheus for metrics. It takes about five minutes and needs only Docker.

The layout

ServiceRoleAddress
otel-studioGenerates traces, logs and metricshttp://localhost:3002
otelcolReceives OTLP, exports traces to Jaeger, exposes metrics for Prometheus, prints logsOTLP on 4317 (gRPC) and 4318 (HTTP)
jaegerStores and shows traceshttp://localhost:16686
prometheusStores and queries metricshttp://localhost:9090

The files

Create a folder with three files. First otelcol.yaml:

receivers:
  otlp:
    protocols:
      grpc: { endpoint: 0.0.0.0:4317 }
      http: { endpoint: 0.0.0.0:4318 }
processors:
  batch: {}
exporters:
  otlp/jaeger:
    endpoint: jaeger:4317
    tls: { insecure: true }
  prometheus:
    endpoint: 0.0.0.0:8889
  debug:
    verbosity: basic
service:
  pipelines:
    traces:  { receivers: [otlp], processors: [batch], exporters: [otlp/jaeger] }
    metrics: { receivers: [otlp], processors: [batch], exporters: [prometheus] }
    logs:    { receivers: [otlp], processors: [batch], exporters: [debug] }

Then prometheus.yml, which scrapes the Collector:

scrape_configs:
  - job_name: otelcol
    scrape_interval: 10s
    static_configs:
      - targets: ["otelcol:8889"]

And compose.yaml:

services:
  otel-studio:
    image: ghcr.io/xplurdata/otel-studio:latest
    ports: ["3002:3002"]
    environment:
      ADMIN_PASS: change-me-please
      OTEL_ENDPOINT: http://otelcol:4317
      OTEL_PROTOCOL: grpc
    volumes: ["studio-data:/data"]
    depends_on: [otelcol]
  otelcol:
    image: otel/opentelemetry-collector-contrib:latest
    command: ["--config=/etc/otelcol-contrib/config.yaml"]
    volumes: ["./otelcol.yaml:/etc/otelcol-contrib/config.yaml:ro"]
    depends_on: [jaeger]
  jaeger:
    image: jaegertracing/jaeger:latest
    ports: ["16686:16686"]
  prometheus:
    image: prom/prometheus:latest
    ports: ["9090:9090"]
    volumes: ["./prometheus.yml:/etc/prometheus/prometheus.yml:ro"]
volumes:
  studio-data: {}

Run it

docker compose up -d
docker compose logs -f otelcol
  1. Open http://localhost:3002, sign in as admin with the password from the file, and press Start. The endpoint was pre-created from OTEL_ENDPOINT.
  2. Traces: open Jaeger at localhost:16686, choose a service such as frontend and click Find Traces. Open one to see the parent-child spans across services.
  3. Metrics: open Prometheus at localhost:9090 and try http_requests_total or sum(rate(http_errors_total[1m])). Names are converted from dotted OpenTelemetry names to underscores.
  4. Logs: watch docker compose logs -f otelcol; switch the debug exporter to verbosity: detailed to see full records, including the trace and span IDs that tie each log to a trace.

Experiments to run

For anything beyond a laptop, pin image versions instead of latest, give Prometheus and Jaeger persistent storage, and put the Collector behind authentication. This sandbox is intentionally disposable: docker compose down -v removes everything.

Keep going