Skip to content

Jaeger for distributed tracing — install, storage choices, and the trace queries that actually answer questions

A working Jaeger deployment with Elasticsearch or Cassandra storage, OTLP receivers, a sampler, and the trace UI and TraceQL queries we use during latency investigations.

Jaeger is the longest-running, simplest-to-stand-up distributed-tracing backend in the CNCF stable. It accepts OTLP and Jaeger-native protocols, stores spans in Elasticsearch, Cassandra, or an in-memory database (good only for demos), and gives you a search UI that lets an operator find the slow path in a request that crossed five services. This article walks through a small but production-shaped Jaeger install, the storage tier choice, the integration with OpenTelemetry Collector, and the query patterns we use during a latency investigation.

How to verify

After install, end-to-end confirmation in three checks:

# Collector accepting spans
curl -fsS http://127.0.0.1:14269/ | jq 2>/dev/null || echo 'collector health endpoint missing'
ss -lntp | grep -E ':(4317|4318|14250|14268|16686)\b'

# Storage backend reachable
curl -fsS http://es-jaeger.internal:9200/_cat/indices?v | grep jaeger

# Query API returns at least one trace
curl -fsS 'http://jaeger.internal:16686/api/services' | jq '.data'
curl -fsS 'http://jaeger.internal:16686/api/traces?service=demo-app&limit=1' | jq '.data[0] | {traceID, spans: (.spans|length)}'

If the service list is empty even though apps are sending, check the Collector’s metrics: curl http://jaeger.internal:14269/metrics | grep jaeger_collector_spans_received. If received is nonzero but saved is zero, the storage write is failing.

What’s happening

A trace is a tree of spans, each span carrying a service name, operation name, start/end timestamps, and a tag/log set. Jaeger has three architectural pieces: a collector that receives spans (via OTLP gRPC/HTTP on 4317/4318, Jaeger gRPC on 14250, Jaeger HTTP on 14268), an agent (deprecated in modern deployments — the Collector accepts direct pushes), and a query service that exposes the search API and the UI on 16686.

Storage is the choice that decides scale. In-memory is the all-in-one default and loses data on restart — fine for tutorials, nothing else. Elasticsearch is the easy choice for teams that already run ELK; trace indices live alongside logs, ILM evicts old data, query is fast for the common “find a trace by service+operation+time-range” pattern. Cassandra scales further for very high write volumes but adds operational weight; reserve it for environments that already operate Cassandra.

The other choice is sampling. Jaeger supports remote sampling — the SDK polls a strategies endpoint and applies the rate the operator configured, so changing sample rates does not require an app redeploy. The strategies file lives in the collector and is reloaded on change.

The procedure

  1. Provision Elasticsearch (or use an existing cluster). A 3-node cluster sized for the trace volume — typically 1.5 × the equivalent log volume because spans are wider than log lines. See elk-stack-basics for a single-host start.

    # Create the user and role used by Jaeger writers
    curl -X POST -u elastic:$PWD -H 'Content-Type: application/json' \
      http://es.internal:9200/_security/role/jaeger_writer -d '{
        "indices":[{"names":["jaeger-*"],"privileges":["create_index","write","manage"]}]
      }'
    curl -X POST -u elastic:$PWD -H 'Content-Type: application/json' \
      http://es.internal:9200/_security/user/jaeger -d '{
        "password":"<rotate-me>","roles":["jaeger_writer"]
      }'
  2. Deploy the Jaeger Collector + Query (all-in-one binary in single-host mode, or split deployments).

    # docker-compose.yml on the trace host
    services:
      jaeger:
        image: jaegertracing/all-in-one:1.62
        ports:
          - "127.0.0.1:16686:16686"   # UI
          - "127.0.0.1:14250:14250"   # gRPC collector (Jaeger native)
          - "127.0.0.1:14268:14268"   # HTTP collector (Jaeger native)
          - "127.0.0.1:4317:4317"     # OTLP gRPC
          - "127.0.0.1:4318:4318"     # OTLP HTTP
        environment:
          SPAN_STORAGE_TYPE: elasticsearch
          ES_SERVER_URLS: http://es.internal:9200
          ES_USERNAME: jaeger
          ES_PASSWORD: "${ES_PASSWORD}"
          ES_INDEX_PREFIX: jaeger
          ES_NUM_SHARDS: "1"
          ES_NUM_REPLICAS: "1"
          COLLECTOR_OTLP_ENABLED: "true"
          SAMPLING_STRATEGIES_FILE: /etc/jaeger/sampling.json
        volumes:
          - ./sampling.json:/etc/jaeger/sampling.json:ro
        restart: unless-stopped
  3. Write a sampling strategy file. Default sampling rate for unknown services, per-service overrides for traffic-heavy or low-importance services.

    // sampling.json
    {
      "default_strategy": { "type": "probabilistic", "param": 0.1 },
      "service_strategies": [
        { "service": "demo-app",  "type": "probabilistic", "param": 1.0 },
        { "service": "metrics-scraper", "type": "probabilistic", "param": 0.01 },
        { "service": "checkout",
          "type": "probabilistic", "param": 0.5,
          "operation_strategies": [
            { "operation": "GET /health", "type": "probabilistic", "param": 0.001 }
          ]
        }
      ]
    }

    The Collector reloads this file every minute; sample rate changes propagate to SDKs that have remote sampling enabled.

  4. Point your apps at the OTLP endpoint. Either configure each SDK directly (see opentelemetry-apm) or send via the OTel Collector with exporters.otlp/jaeger.endpoint: jaeger.internal:4317.

  5. Set Elasticsearch ILM on the jaeger indices. Otherwise indices grow forever. Jaeger creates one index per day; a 30-day retention with rollover at 50 GB per index is a reasonable starting point — see the policy snippet in elk-stack-basics and adjust the pattern to jaeger-*.

  6. Front the UI with TLS + auth. Jaeger’s UI has no built-in auth.

    server {
      listen 443 ssl http2;
      server_name jaeger.example.com;
      ssl_certificate     /etc/letsencrypt/live/jaeger.example.com/fullchain.pem;
      ssl_certificate_key /etc/letsencrypt/live/jaeger.example.com/privkey.pem;
      auth_basic "jaeger";
      auth_basic_user_file /etc/nginx/htpasswd.jaeger;
      location / { proxy_pass http://127.0.0.1:16686; proxy_set_header Host $host; }
    }
  7. Use the search UI deliberately. Three query patterns we run during incidents:

    • Slow trace — service checkout, operation POST /api/checkout, min duration 2s, last 30 minutes. The UI returns the slowest traces in that window; click into one and look for the span that consumed the bulk of the time.
    • Error trace — service *, tag error=true, last 1 hour. Find every trace that contains an error span.
    • Trace by ID from a log line — pop the trace_id from a log line into the UI’s “Lookup by Trace ID” field. This is what closes the loop between Loki and Jaeger.

Operational notes

  • A trace that crosses multiple services without parent-child IDs propagated correctly shows up as multiple disconnected traces; the SDK has to inject and read W3C trace context headers (traceparent) at every HTTP/gRPC call.
  • ES_NUM_SHARDS: 1 is fine for a small deployment; bump it once daily index size exceeds 30 GB.
  • The Collector’s queue is in memory; a backend outage longer than the queue (default 2000 spans) drops spans. For long-tail resilience, prefer routing through the OpenTelemetry Collector first — it has a larger disk-backed queue.
  • Span tag cardinality matters less than label cardinality in Prometheus, but a tag like user_id still bloats index size; redact it at the Collector level.
  • The Jaeger UI’s “Compare” feature is unreasonably useful — compare a slow trace to a fast one for the same operation and the offending span is highlighted instantly.

For the Collector side that fans OTLP to Jaeger and other exporters, see opentelemetry-apm. For an alternative tracing backend on object storage, see grafana-tempo-tracing-s3-deploy.


Stack Harbor stands up Jaeger backends on the managed operations tier — sized for the trace volume the client actually produces, sampling strategies reviewed during change windows, indices on ILM so the disk does not write the cluster into read-only mode.