Jaeger & Tempo: Storing & Finding Traces
Spans leave the Collector for a tracing backend that stores them, assembles traces and lets you search. The two open-source choices in this course's stack are Jaeger and Grafana Tempo; both accept OTLP.
| Jaeger v2 | Grafana Tempo | |
|---|---|---|
| origin | Uber, CNCF graduated | Grafana Labs |
| architecture | v2 is built on the OpenTelemetry Collector (one binary with Jaeger's storage and UI as Collector components) | distributor, ingester, querier, compactor; single-binary or microservices |
| storage | Elasticsearch/OpenSearch, Cassandra, Badger, memory, or remote storage via gRPC | object storage only (S3, GCS, Azure), Parquet blocks: cheap |
| search | by service, operation, tags, duration in the Jaeger UI | TraceQL, in Grafana; trace ID lookup; search by attributes |
| extras | service dependency graph, trace comparison, SPM (metrics from spans) | metrics-generator (span metrics, service graphs), exemplar links from Prometheus, logs ↔ traces in Grafana |
Jaeger v1 reached end of life at the end of 2025; new installations use v2 (configured like a Collector, with jaeger_storage and jaeger_query extensions). Tempo fits naturally when Grafana, Loki and Prometheus are already there, which is the capstone's case.
Running them
# sample sessions
# Jaeger v2 all-in-one (in-memory storage, UI on :16686, OTLP on 4317/4318)
JAEGER_VERSION=2.x.y # pin the current 2.x release from the Jaeger releases page
docker run --rm -p 16686:16686 -p 4317:4317 -p 4318:4318 "jaegertracing/jaeger:$JAEGER_VERSION"
# Tempo in Kubernetes with object storage
helm repo add grafana https://grafana.github.io/helm-charts
helm install tempo grafana/tempo-distributed -n observability -f tempo-values.yamlA minimal Tempo config (single binary, local storage for a lab):
# tempo.yaml
server:
http_listen_port: 3200
distributor:
receivers:
otlp:
protocols:
grpc: {endpoint: 0.0.0.0:4317}
http: {endpoint: 0.0.0.0:4318}
storage:
trace:
backend: local # s3 / gcs / azure in production
local: {path: /var/tempo/traces}
wal: {path: /var/tempo/wal}
metrics_generator:
processor:
service_graphs: {}
span_metrics: {}
storage:
path: /var/tempo/generator/wal
remote_write:
- url: http://prometheus:9090/api/v1/write
send_exemplars: true
overrides:
defaults:
metrics_generator:
processors: [service-graphs, span-metrics]The Collector exports to it with an otlp_grpc exporter pointing at tempo:4317 (The OpenTelemetry Collector).
TraceQL
TraceQL selects spans with conditions in braces, and traces through relations between spans. It looks like LogQL on purpose:
{ resource.service.name = "linkly" && span.http.route = "/links" && status = error }
{ resource.service.name = "linkly" && duration > 500ms }
# traces where linkly called PostgreSQL and that call took over 100 ms
{ resource.service.name = "linkly" } >> { span.db.system.name = "postgresql" && duration > 100ms }
# aggregate per trace: traces with more than 20 database calls (an N+1 query bug)
{ span.db.system.name = "postgresql" } | count() > 20
# metrics from traces (TraceQL metrics, needs the local-blocks processor)
{ resource.service.name = "linkly" && status = error } | rate() by (span.http.route)| Element | Meaning |
|---|---|
span. / resource. / . |
attribute scope: span attribute, resource attribute, either |
| intrinsics | name, status, kind, duration, traceDuration, rootServiceName |
>>, >, ~ |
descendant, direct child, sibling of the left-hand spans |
| ` | count(), avg(duration), select(...)` |
Exemplars: from a metric to a trace
An exemplar is a sample trace ID attached to a metric observation: "this bucket of the latency histogram was hit by trace 4bf9…". client_golang records them with ObserveWithExemplar (otelhttp-instrumented handlers can add the current trace ID); Prometheus stores them when started with --enable-feature=exemplar-storage, and they are exposed in the OpenMetrics format:
http_request_duration_seconds_bucket{route="/links",le="0.5"} 1832 # {trace_id="4bf92f3577b34da6a3ce929d0e0e4736"} 0.212 1767261600.123In Grafana, exemplars appear as dots on the latency graph; clicking one opens the trace in Tempo (configured by exemplarTraceIdDestinations in the Prometheus data source, see Grafana: Data Sources & Panels). Together with trace_id in log lines (derived fields in the Loki data source) and "logs for this span" from Tempo, this closes the loop: metric → trace → logs in three clicks.
A sample investigation
1. Alert: LinklyHighLatency p99 /links 1.8 s (SLO 300 ms)
2. Dashboard: p99 up on /links only, since 14:05; DB pool "in use" at max (Prometheus)
3. Exemplar on the latency panel → trace 4bf9…: INSERT links 1.6 s, of which (Tempo)
pool.acquire 1.5 s
4. TraceQL: { span.name = "pool.acquire" && duration > 1s } | count() by (resource.service.version)
→ only version 1.5.0
5. Logs for the trace: "pool exhausted, max_conns=5" (Loki)
6. Diff of 1.5.0: max_conns default changed from 20 to 5 → roll backTest yourself
What is Jaeger v2 built on?
- Elasticsearch
- The OpenTelemetry Collector
- Prometheus
- Loki
Which TraceQL query finds linkly spans slower than 500 ms?
{app="linkly"} | duration > 500ms{ resource.service.name = "linkly" && duration > 500ms }rate(linkly[500ms])select * where duration > 500
What is an exemplar?
- A sample dashboard
- A trace ID attached to a metric observation, linking a graph point to a concrete trace
- A recording rule
- An example alert