AlgoViz

Jaeger

medium 28 min

Jaeger is an open-source store and viewer for distributed traces.

Video lesson · Chapter 1 of 5

A payment vanishes inside a six-hundred-millisecond request

0:00 / 4:02

Jaeger in 90 seconds

1:30Reel coming soon

Theory

Read or listen first. About 2 min.

What it is

Jaeger is a backend for distributed tracing. A trace is the record of one request through many services. It is made of spans: each span is one piece of work with a name, a start, a duration and a link to its parent.

Jaeger receives spans, stores them, and offers a web interface and an API to search and compare traces. It does not create spans. Applications do that with OpenTelemetry, and send them in the OTLP format.

It only keeps traces. Other telemetry, such as logs and metrics, belongs in other stores.

Why it exists

A page is slow. It calls five services, and each of them calls others. Every service's own log looks fine, because each sees only its own part. Someone has to join the parts of the same request.

Tracing does that with one id that travels with the request. The picture then shows which call took the time, which ran one after another although they could run together, and where an error began.

A short history

  1. 2010

    Google publishes a paper about Dapper, its tracing system. It describes spans, trees and sampling.

  2. 2016

    Uber Technologies releases Jaeger as open source.

  3. September 2017

    The Cloud Native Computing Foundation accepts Jaeger.

  4. October 2019

    Jaeger becomes a graduated project.

  5. November 2024

    Jaeger v2 is released. It is built on the OpenTelemetry Collector framework.

  6. December 2025

    Version 1 reaches its end of life on the 31st. Only v2 is maintained.

Words to know

Trace
All spans of one request, joined by a 16-byte trace id.
Span
One piece of work: name, start, duration, parent, attributes, events, status.
Context propagation
Passing the trace id and parent span id to the next service, usually in the traceparent header.
Collector role
A Jaeger process that receives spans and writes them.
Query role
A Jaeger process that serves the API and the web interface.
Ingester role
A Jaeger process that reads spans from Kafka and writes them to storage.
Remote sampling
SDKs ask Jaeger which share of requests to trace.
SPM
Service performance monitoring: rate, errors and duration per service, computed from spans.

How it works

Step through the idea, or press Play.

Step 1 of 3

Create. Services make spans and pass the id on

Understand it

Start here

A ribbon through the fairground

A parcel goes from stall to stall in a fairground, and comes out after twelve minutes. Nobody knows where the time went. Imagine how a coloured ribbon could show it.

Follow one parcel
TICKETSBIG WHEELPRIZES12 MINTwelve minutes, but why?

One ribbon is enough to see the path. Not every parcel needs one.

Model

Spans, parents and one id

One trace as data

SpanParentStartDurationService
A: POST /ordernone0 ms600 msweb
B: reserveA20 ms80 msstock
C: chargeA110 ms460 mspay
D: bank callC130 ms420 mspay
C takes 460 ms, but 420 of them are D. The self time of C is 40 ms.

Self time of a span

tself=tspan−∣⋃children[start, end]∣600−(80+460)=60 mst_{\text{self}} = t_{\text{span}} - \left|\bigcup_{\text{children}} [\text{start},\ \text{end}]\right| \qquad 600 - (80 + 460) = 60\ \text{ms}
The time of A outside its children. Children that run at the same time are counted once, so take the union, not the sum.

How the id travels

Spans are not sent with the request. Each service exports its own, and Jaeger joins them by trace id.

Attributes such as http.response.status_code and user.tier make traces searchable. Do not put secrets or personal data into them: everyone who may open Jaeger can read them.

Inside

One program, several roles

Direct to storage

Inside our system, services with the OpenTelemetry SDK send OTLP to a Jaeger collector. It writes spans to Elasticsearch. A Jaeger query process reads traces and shows pages to engineers outside.
Collector and query are stateless, so both can run many times. All state is in the storage.
  • Collector

    Receives OTLP, also Zipkin and older Jaeger formats. Batches and writes.

  • Query

    Search API and web interface on port 16686.

  • Ingester

    A collector that reads from Kafka instead of the network.

  • All-in-one

    Collector and query in one process. With memory storage it is for tests only.

  • Storage extension

    One place that names the databases, for writing and for reading.

  • Agent: not needed

    The old Jaeger agent is gone. Use an OpenTelemetry Collector next to the app if you need one.

Ports

PortProtocolFor
4317gRPCOTLP spans in
4318HTTPOTLP spans in, /v1/traces
9411HTTPZipkin spans in
5778, 5779HTTP, gRPCRemote sampling answers
16686HTTPWeb interface and JSON API
16685gRPCQuery API v3
8888HTTPJaeger's own metrics
13133HTTPHealth check
14250 and 14268 and the UDP ports 6831 and 6832 belong to deprecated formats.
YAML
service:  extensions: [jaeger_storage, jaeger_query, healthcheckv2]  pipelines:    traces:      receivers: [otlp]      processors: []      exporters: [jaeger_storage_exporter]extensions:  healthcheckv2:    use_v2: true    http:  jaeger_query:    storage:      traces: main      traces_archive: archive  jaeger_storage:    backends:      main:        elasticsearch:          server_urls: ["https://es1:9200"]          indices:            index_prefix: "jaeger-main"            spans: { date_layout: "2006-01-02", rollover_frequency: "day", shards: 5, replicas: 1 }      archive:        elasticsearch:          server_urls: ["https://es1:9200"]          indices: { index_prefix: "jaeger-archive" }receivers:  otlp:    protocols:      grpc: { endpoint: "0.0.0.0:4317" }      http: { endpoint: "0.0.0.0:4318" }exporters:  jaeger_storage_exporter:    trace_storage: main
Shortened from the sample in the Jaeger repository. The date is Go's way to write year-month-day. Version 2 reads this file, not the old environment variables. Add authentication and TLS for your cluster.

Sampling

Which requests get a ribbon

OpenTelemetry SDKs trace everything unless told otherwise. With many requests that costs too much, so most systems keep a share. All services must keep the same traces, otherwise trees have holes. That is why the decision travels with the request.

What it costs to keep everything

5000 reqs×8 spans×500 B=20 MBs≈1.73 TBday1%: 17.3 GBday5000\ \tfrac{\text{req}}{\text{s}} \times 8\ \text{spans} \times 500\ \text{B} = 20\ \tfrac{\text{MB}}{\text{s}} \approx 1.73\ \tfrac{\text{TB}}{\text{day}} \qquad 1\%:\ 17.3\ \tfrac{\text{GB}}{\text{day}}
Assumed request rate, span count and size, before indexes and copies. Peak is 3x.

Kinds of sampling

KindWho decides, whenGoodBad
Head, fixed shareFirst service, at the startCheap, simpleCannot know that the request will fail
Remote, from a fileJaeger tells SDKs a share per service and operationOne place to change itOnly SDKs with this feature
Remote, adaptiveJaeger computes the share from trafficQuiet endpoints are not forgottenNeeds a sampling store
TailJaeger or a Collector, after the traceKeeps errors and slow onesAll spans must be sent, held and come to one process
JSON
{  "service_strategies": [    { "service": "checkout", "type": "probabilistic", "param": 0.5 },    { "service": "search", "type": "ratelimiting", "param": 5 }  ],  "default_strategy": {    "type": "probabilistic",    "param": 0.05,    "operation_strategies": [      { "operation": "/health", "type": "probabilistic", "param": 0.0 }    ]  }}
Half of checkout, five traces a second from search, five percent of the rest, no health checks. Without a file, Jaeger answers with 0.001, which is one in a thousand.

Choosing a sampling method

A rare error and a small share do not go together. If 5 requests an hour fail and you keep 1 percent, you expect one failed trace about every 20 hours. The chance to catch none of the 120 in a day is 0.99 to the power of 120, about 30 percent.

Storage

Where traces live

StorageGood forMind
MemoryTrying it outLost on restart; no limit unless you set max_traces
BadgerOne machine, modest volumeLocal files, no second instance
Elasticsearch or OpenSearchProduction with search; the team's recommendationOld data leaves by index, which you must set up
CassandraFast lookup by trace id, built-in TTLSearch is done in Jaeger: many extra writes, limited results
ClickHouseCompression and analyticsMarked experimental; the schema may change
Remote storage (gRPC)Your own backendYou write and run the server

The Elasticsearch page names versions 7.x and 8.x, so check it before using a newer cluster. Jaeger makes daily indices by default, and a cleaner job deletes old ones. The documentation recommends rollover with ILM instead, where Elasticsearch opens and deletes indices by itself. Cassandra's automatic schema has a lifetime of 48 hours and replication factor 1, so change both for production.

Two ways to write to Elasticsearch

async (default)sync
The sender hearsAccepted, before it is storedSuccess or error after the bulk request
SpeedHighest throughputOne round trip per batch
A failed writeLogged and counted, then goneGoes back to the pipeline, which can retry
Each span has an id computed from its content, so a repeated write replaces the same document within one index.

Peaks

Kafka as a buffer

Collect now, store later

Inside our system, services send OTLP to collectors, collectors write to a Kafka topic keyed by trace id, ingesters read the topic and write to trace storage.
The trace id is the key, so all spans of a trace are in one partition.

Direct to storage, a collector has a queue in memory. If storage stays slow, the queue fills and spans are dropped. More collectors do not help then: the slow part is the storage. Kafka keeps spans on disk until ingesters catch up, and other programs can read them too. More ingesters than partitions stand idle.

A traffic peak with and without a buffer

Read

Reading a trace

  1. 1

    Find it

    By trace id from a log line or error page, or by service, operation, attributes and minimum duration.

  2. 2

    Look for the longest bar

    Then for its self time. A long parent with a long child is not the cause.

  3. 3

    Look at the shape

    A staircase means calls one after another. Many short equal bars often mean one query per item.

  4. 4

    Look for gaps

    Empty time between children is work without a span, or waiting in a queue.

  5. 5

    Compare

    Put a slow trace beside a normal one. Jaeger can show the difference.

What does the shape tell you?

Side by side

  • Three calls of 100 ms start together
  • Total: about 100 ms
  • The slowest child decides

Staircase

  • Three calls of 100 ms, one after the other
  • Total: about 300 ms
  • Ask: does the second need the first?

Service performance monitoring shows rate, errors and duration (p50, p75, p95) per service and operation. It needs metrics made from spans, kept in a Prometheus-compatible store, or Elasticsearch or OpenSearch. If you sampled before counting, the rates are too low: count first, then sample. The service map in production needs a separate job that reads the stored spans.

Operate

Running it

What to watch

SignalMeansDo
Accepted spans far above sent spansSpans wait or are lost between receiving and storingLook at storage and queue
Refused spansThe collector cannot take moreScale collectors or sample more
Failed exportsStorage answers with errorsCheck disk, mapping, credentials
Kafka lag growsIngesters or storage too slowAdd ingesters up to the partitions, then storage
Traces with missing parentsA service drops or does not pass the contextCheck propagation and filters
The metric names start with otelcol_receiver and otelcol_exporter, as in an OpenTelemetry Collector.

Upgrade from the end of the path: first query, then ingester, then collector, so that readers understand the new data. The Helm chart or the OpenTelemetry Operator installs v2 on Kubernetes.

Choose

When another tool fits better

NeedBetter choiceWhy
Create spans in codeOpenTelemetryJaeger's own client libraries are retired
Alerts on ratesPrometheusMetrics are complete, traces are sampled
Text of every eventELK StackLogs are not spans
Very cheap storage, mostly lookup by idGrafana TempoKeeps traces in object storage
One product for all signals, hostedDatadog or a similar serviceNothing to run, a bill instead
One program, no remote callsA profilerThere is nothing distributed

Jaeger is under the Apache 2.0 licence and free to use. The cost is the storage cluster and the people who run it.

Summary

The whole topic in one minute.

Services make spans with OpenTelemetry and send them over OTLP. Jaeger's collector writes them to a database, and the query role shows them as a timeline.

The cost is spans a second times size times days, so sampling is the main control. Head sampling is cheap and blind, tail sampling sees the whole trace and needs memory.

Jaeger v2 is one program with several roles, configured in YAML like an OpenTelemetry Collector. The state is in the storage, which is therefore the part to size and to protect.

  • A trace is a tree of spans with one id. Jaeger stores and shows it; OpenTelemetry makes it.
  • Jaeger v2 is one binary with roles, built on the OpenTelemetry Collector. Version 1 ended in December 2025.
  • Collector and query are stateless. Storage is the limit.
  • Sampling decides the cost. Head is cheap and blind, tail is informed and heavy.
  • Elasticsearch or OpenSearch are recommended for search; memory is for tests.
  • Kafka absorbs peaks; more collectors do not fix slow storage.
  • The interface has no accounts: protect it.

Sources