Jaeger: Distributed Tracing for Microservices
Run Jaeger v2.23 with OpenTelemetry, search traces, and choose storage and sampling settings for local development or production deployments.
Jaeger v2.23 is built on the OpenTelemetry Collector and can run as an all-in-one process or as separate collector and query roles. This guide uses versioned commands and examples to explain storage choices, sampling, and trace investigation from local development through production.
Jaeger: Distributed Tracing for Microservices
Jaeger collects and displays traces so you can follow a request across services. It accepts OpenTelemetry data, stores spans, and lets you search for slow or failed requests.
This guide uses Jaeger v2.23.0. Its commands and sampling examples were checked against the Jaeger documentation on 2026-11-18. Jaeger v1 reached end of life on 2025-12-31; avoid copying its Operator manifests, jaeger-agent setup, or unpinned all-in-one:latest image into a v2 deployment. See the Jaeger v2.23 architecture and release page when upgrading.
If you are new to tracing, start with the distributed tracing guide.
Jaeger v2 architecture
Jaeger v2 is a distribution of the OpenTelemetry Collector. A single Jaeger binary can run different roles. A normal trace path looks like this:
flowchart LR
App["Application with OpenTelemetry SDK"] -->|"OTLP"| Receiver["Jaeger v2 receiver"]
Receiver --> Processor["Collector processors"]
Processor --> Exporter["Jaeger storage exporter"]
Exporter --> Store["Trace storage"]
Query["Jaeger query extension and UI"] --> Store
Collector["Optional OpenTelemetry Collector"] -->|"OTLP"| Receiver
App -. "OTLP" .-> Collector
The main roles are:
| Role | What it does |
|---|---|
| All-in-one | Runs ingestion and query in one process. The default setup uses in-memory storage, so traces disappear when the process stops. |
| Collector | Receives and processes spans, then writes them to the configured storage backend. |
| Query | Serves the query APIs and Jaeger UI. It reads from the same configured trace store as the collector. |
| Ingester | Reads spans from Kafka and writes them to storage in a collector–Kafka–ingester deployment. |
A separate OpenTelemetry Collector is optional. Add one as a sidecar, host service, or remote cluster when you want a local relay, data enrichment, or a shared pipeline for traces, metrics, and logs. Jaeger v2 can also be configured for an agent role, but the project recommends the standard OpenTelemetry Collector for that job.
Run Jaeger locally
For a short-lived development instance, run the Jaeger v2.23.0 image:
docker run --rm --name jaeger \
-p 16686:16686 \
-p 4317:4317 \
-p 4318:4318 \
-p 5778:5778 \
-p 9411:9411 \
jaegertracing/jaeger:2.23.0
Open http://localhost:16686 for the UI. The ports include the UI, OTLP over gRPC and HTTP, remote sampling, and the Zipkin receiver. The all-in-one configuration stores traces in memory; this is useful for learning and local tests, but data is lost when the container exits.
Jaeger does not create application traces by itself. Instrument the service with an OpenTelemetry SDK or agent and send spans to the OTLP endpoint. For a local app using OTLP/HTTP, the endpoint is usually http://localhost:4318. In a container network, use the Jaeger service name instead of localhost.
Choose a deployment shape
Pick roles and storage based on traffic, retention, and the cost of losing trace data.
| Use | Jaeger roles | Storage | Notes |
|---|---|---|---|
| Local development or CI | All-in-one | Memory | Fast to start. Data is temporary and should not be used for incident history. |
| Single node with modest volume | All-in-one | Badger | Persists data on local disk, but remains a single-node setup and cannot scale horizontally. |
| Production in one region | Separate collector and query roles | OpenSearch, Elasticsearch, or Cassandra | Use an external store with a retention policy. Jaeger currently recommends OpenSearch over Cassandra for large-scale production deployments. |
| Ingestion bursts or replay needs | Collector, Kafka, ingester, query | A supported persistent backend after Kafka | Kafka buffers spans between collectors and ingesters; it is not a replacement for the backend used by query. |
The all-in-one and split collector/query layouts can both use external storage. Splitting the roles lets you scale ingestion and reads separately and apply different network or access policies. For a configuration beyond the local setup, use the versioned Jaeger configuration guide and its working configuration examples.
Storage choices
Jaeger v2.23 documents Cassandra, Elasticsearch, and OpenSearch as distributed trace stores. ClickHouse is available through the Remote Storage API as an experimental option. Check the current storage backend guide before choosing a backend; support and operational trade-offs can change between releases.
| Backend | Good fit | Limits to account for |
|---|---|---|
| Memory | Demos and tests | Data is lost on restart. Set max_traces if a test process needs a bound. |
| Badger | A modest single-node install | Local, single-node storage. It does not provide horizontal scaling. |
| OpenSearch | Large production deployments | Plan index retention, capacity, access control, and query load. Jaeger recommends it over Cassandra at large scale. |
| Elasticsearch or Cassandra | Existing deployments with operational expertise | Confirm the version and configuration supported by the Jaeger release you deploy. |
| Kafka | Buffering spans before ingestion | A Kafka deployment still needs an ingester and a persistent backend for query. |
Keep the primary trace retention period as short as incident response and compliance allow. Long retention increases storage and query costs. Avoid putting credentials, access tokens, or unnecessary personal data in span attributes.
Configure the collector pipeline
Jaeger v2 uses an OpenTelemetry Collector-style YAML file. A pipeline names its receivers, processors, and exporters; extensions provide Jaeger storage and query services. This is the shape of a small in-memory pipeline:
service:
extensions: [jaeger_storage, jaeger_query, remote_sampling]
pipelines:
traces:
receivers: [otlp]
processors: [batch]
exporters: [jaeger_storage_exporter]
extensions:
jaeger_storage:
backends:
local_traces:
memory:
max_traces: 100000
jaeger_query:
storage:
traces: local_traces
remote_sampling:
file:
path: ./sampling-strategies.json
receivers:
otlp:
protocols:
grpc:
endpoint: 0.0.0.0:4317
http:
endpoint: 0.0.0.0:4318
processors:
batch: {}
exporters:
jaeger_storage_exporter:
trace_storage: local_traces
This example uses memory and is for local learning. Replace the storage backend with one supported by your Jaeger release before using the pipeline for production. Run a custom configuration with jaeger --config config.yaml; Jaeger v2 does not use Jaeger v1’s environment-variable configuration model. The v2 YAML can reference environment variables where supported.
Send OpenTelemetry data
Set a stable service.name resource attribute for each instrumented service. Jaeger groups traces by service name, so inconsistent names split the search results.
For an application whose OpenTelemetry SDK reads standard environment variables, an OTLP/HTTP setup can look like this:
OTEL_SERVICE_NAME=checkout \
OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4318 \
OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf \
java -jar checkout-service.jar
The application still needs OpenTelemetry instrumentation and an OTLP exporter. The environment variables only configure an SDK or agent that supports them. In production, point the endpoint at the reachable Collector or Jaeger service and enable TLS and authentication where traffic crosses a trust boundary.
If a team already emits Zipkin spans, Jaeger v2 includes a Zipkin receiver. Configure it in the v2 pipeline and route Zipkin traffic to that receiver. Do not use the Jaeger v1 COLLECTOR_ZIPKIN_HOST_ENDPOINT environment variable with Jaeger v2. See the v2 configuration examples.
Sampling, with examples pinned to v2.23.0
Sampling controls how many traces applications record and Jaeger stores. The examples in this section follow the Jaeger v2.23 sampling guide.
Head-based sampling
The SDK makes a decision when a trace starts. This has low backend cost, but a low probability can miss rare errors.
Remote sampling
Remote sampling is head-based sampling with policies served by Jaeger. It is useful when many services need centrally managed rates. The complete pipeline configuration above both registers remote_sampling under service.extensions and configures its file source under extensions. Both entries are required; without the service registration, Jaeger does not start the Remote Sampling API.
For example, sampling-strategies.json can set a service-specific probability and a default for services without an explicit rule:
{
"service_strategies": [
{
"service": "checkout",
"type": "probabilistic",
"param": 0.1
}
],
"default_strategy": {
"type": "probabilistic",
"param": 0.01
}
}
A probability of 0.1 samples about one in ten traces on average. It does not guarantee that every error is retained. Jaeger v2.23 returns a default probability of 0.001 when remote sampling has no configuration, so set an explicit policy instead of relying on that default.
Tail-based sampling
Tail sampling makes a decision after spans arrive at the Collector. It can keep traces that match a policy, such as slow or failed traces, but the Collector must receive the trace before it can decide. This uses more memory and processing than head sampling.
Jaeger v2.23 supports tail sampling through the OpenTelemetry Collector tail_sampling processor. Start from the versioned Jaeger tail-sampling example, then replace its test policy with rules that match your service’s needs. Do not use an always-sample policy in a high-volume production pipeline.
Before increasing sampling rates, estimate the added application export traffic and storage volume. For tail sampling, make sure spans for a trace reach the same sampling decision point and that the Collector has enough memory for its decision window.
Adaptive sampling
Adaptive sampling adjusts head-sampling probabilities from observed traffic. Its storage and configuration requirements depend on the deployment. Follow the v2.23 sampling documentation and use a matching configuration example.
Find and inspect traces
The Jaeger UI has several documented views. The Search page filters by service, operation, time range, duration, tags, and trace ID. The Trace page presents spans as a timeline; selecting a span opens its attributes and events. Other trace views include a graph, flame graph, statistics table, and JSON.
The v2.23 feature documentation names two service graphs:
- System Architecture shows one-hop dependencies between services. A link between A and B and another between B and C does not prove that A calls C.
- Deep Dependency Graph shows paths through a selected focal service. It is useful for exploring transitive dependencies, but it is not a complete map of every relationship.
Use System Architecture or Deep Dependency Graph for service relationships, and use trace statistics or an external metrics backend for aggregate performance data.
Investigate a slow request
- Search for the affected service and operation in the time window reported by a user or alert.
- Sort or filter by duration to find slow traces.
- Open a trace and look for a long span or a gap between parent and child spans.
- Inspect that span’s attributes and events. Check whether the delay is in a database, downstream request, queue, or application work.
- Compare several traces before changing code. One trace can be an outlier.
Investigate an error
- Filter for failed spans or the error attribute used by your instrumentation.
- Follow the parent span to see which request path led to the failure.
- Compare a failed trace with a successful trace for the same operation.
- Check that the error and relevant status attributes are recorded without storing secrets or full request bodies.
If a trace looks incomplete, check context propagation at each service boundary. For asynchronous messages, inject trace context into message headers when publishing and extract it when consuming.
Storage, ingestion, and service health
The Jaeger backend exposes Prometheus-compatible metrics. Scrape the metrics endpoints for the roles you run, then monitor ingestion, dropped spans, queue use, query latency, and storage writes. Metric names and available labels can differ by component and release; inspect the output from your deployed v2.23.0 image before writing alerts.
Jaeger traces can help investigate an SLO breach, but Jaeger does not define the service’s SLO or replace metrics-based alerting. Use a metrics system such as Prometheus and Grafana for request rates and error budgets, then follow a trace from a relevant alert to find where time or errors accumulated.
For a large deployment, separate collectors from query services and scale each role against its own load. If the storage backend cannot keep up with sustained ingestion, collectors may drop spans. Kafka can buffer traffic between collectors and ingesters, but it adds another stateful system to operate. Set a retention period and test the behavior of storage failures before relying on traces during an incident.
Failure scenarios to plan for
These are failure modes to test in your environment, not reports of specific incidents.
| Scenario | What you may see | What to check |
|---|---|---|
| The in-memory store restarts | Recent traces disappear | Use memory only for local work. Choose persistent storage when traces must survive restarts. |
| Storage cannot keep up with ingestion | Delayed or missing traces | Check backend write latency, collector queues, dropped-span metrics, and the configured sampling rate. |
| A remote service loses trace context | Separate traces or root spans where child spans were expected | Verify that the OpenTelemetry propagator injects and extracts context across HTTP and messaging boundaries. |
| Sampling is too low for rare errors | Errors occur without matching traces | Review the service and endpoint policies. A low head-sampling rate cannot guarantee error capture. |
| Query traffic affects ingestion capacity | Search becomes slow during heavy writes | Separate collector and query roles and scale them independently when using external storage. |
A useful test is to stop the local Jaeger container and confirm that its in-memory traces are gone. For a production-like setup, test backend unavailability, queue growth, and recovery with a disposable environment before setting retention or sampling policies.
Deployment trade-offs
| Choice | Benefits | Costs and limits | Good fit |
|---|---|---|---|
| All-in-one with memory | One command; easy to reset | No persistence or horizontal scaling | Local development and CI |
| All-in-one with Badger | Persistent local data with few services | Single node and modest volume only | Small standalone install |
| Separate collector and query | Scale reads and writes separately | Requires external storage and more operations work | Production in one region |
| Collector, Kafka, and ingester | Persistent buffer between ingest and storage | More components, capacity planning, and failure modes | Burst handling or replay requirements |
| OpenTelemetry Collector in front | Local processing or shared telemetry pipeline | Adds a hop and another component to monitor | Host, sidecar, or remote collection |
For v2, send OTLP from the application to Jaeger or place the standard OpenTelemetry Collector where local forwarding or processing is needed.
Common mistakes
- Using v1 manifests with v2: v1 Operator CRDs and environment-variable examples do not configure the v2 binary. Start with the v2 configuration docs.
- Treating memory storage as durable: the default all-in-one store is cleared when Jaeger exits.
- Assuming sampled traces are complete evidence: head sampling may omit errors; tail sampling needs every relevant span to arrive before its decision.
- Putting sensitive values in span attributes: traces often have broad access and long retention. Record identifiers only when they are needed and safe to expose.
- Treating a dependency graph as a call path: the System Architecture graph shows one-hop relationships; use an individual trace to inspect a specific request.
- Adding an OpenTelemetry Collector without a reason: Jaeger v2 already uses the Collector framework. Add a separate instance for a specific pipeline need.
Interview questions
Expected answer points:
- An instrumented application uses an OpenTelemetry SDK or agent.
- It exports spans over OTLP to a Jaeger receiver or an OpenTelemetry Collector in front of Jaeger.
- A Collector pipeline processes spans and writes them through the Jaeger storage exporter.
- The query extension reads from the configured backend and serves the UI.
Expected answer points:
- Local development, demos, and short-lived tests.
- It combines ingestion and query roles and needs no external storage.
- Data is lost when the process exits, so it is not a durable production store.
Expected answer points:
- Head sampling decides in the SDK when a trace starts.
- Tail sampling decides after spans reach a Collector and can apply policies to completed traces.
- Tail sampling costs more backend memory and processing and cannot evaluate spans it never receives.
Expected answer points:
- It lets SDKs retrieve head-sampling policies from a central Jaeger endpoint.
- Policies can vary by service or operation.
- It still cannot guarantee that every error trace is retained when sampling probability is below one.
Expected answer points:
- Both roles use shared external storage.
- Ingestion and read traffic can be scaled independently.
- The deployment needs durable storage, access controls, and capacity planning.
Expected answer points:
- Collectors export spans to Kafka as a persistent buffer.
- Ingester processes read spans from Kafka and write them to the trace backend.
- Jaeger query still needs a supported storage backend; Kafka is not the query store in this layout.
Expected answer points:
- System Architecture shows one-hop service dependencies.
- Deep Dependency Graph explores paths through a selected focal service.
- Use a trace view to confirm the call path for a particular request.
Expected answer points:
- Confirm each service injects and extracts trace context.
- Check exporter and collector errors, dropped spans, and sampling policies.
- For queues, propagate context through message headers or properties.
Further reading
- Distributed tracing covers trace context and OpenTelemetry concepts.
- Prometheus and Grafana covers metrics and alerting.
- Jaeger v2.23 architecture describes the roles and deployment patterns.
- Jaeger v2.23 sampling documents head, remote, adaptive, and tail sampling.
- Jaeger v2.23 storage backends lists supported stores and guidance.
Conclusion
Start with the versioned all-in-one image to learn the UI and confirm that an instrumented service exports spans. For production, use persistent storage, set retention deliberately, and separate collector and query roles when their loads need different scaling. Choose sampling only after measuring the trace volume and deciding which gaps you can accept.
Quick recap checklist
- Pin the Jaeger image and configuration to the version you deploy.
- Set a stable
service.nameand confirm the OTLP endpoint and protocol. - Use memory storage only for local work; choose persistent storage and retention for production.
- Scale collector and query roles separately when their loads require it.
- Check collector queues, dropped spans, backend writes, and query latency.
- Review sampling policies against expected traffic and incident needs.
- Keep credentials and unnecessary personal data out of span attributes.
- Test storage failure and recovery before relying on traces during incidents.
Category
Related Posts
Distributed Tracing: Trace Context and OpenTelemetry
Master distributed tracing for microservices. Learn trace context propagation, OpenTelemetry instrumentation, and how to debug request flows across services.
Consistent Hashing for Load Balancing
Learn how consistent-hash rings, virtual nodes, and bounded-load policies reduce reassignment, and when sticky sessions still make sense.
Load Balancing Algorithms: Workloads and Benchmarks
Compare round robin, least-connections, and two-choice routing under mixed request durations with a reproducible workload and operational trade-offs.