Jaeger Adaptive Sampling: Controlling Trace Volume Without Losing Errors
Jaeger's adaptive sampling dynamically adjusts per-operation sampling rates to hit a target traces-per-second budget while preserving 100% of errors and low-latency paths. This blog covers configuration, requirements, a worked example, trade-offs, and a verification checklist for production.
21 Nov 2026, 15:51 UTC

The problem: trace volume vs. signal fidelity
Distributed tracing is only useful if you can afford to store it. A modest microservice fleet generating 5,000 traces per second can overwhelm storage budgets and query performance within hours. Random probabilistic sampling reduces volume but discards the very traces you need most — errors and latency outliers. Jaeger's adaptive sampling, stabilized in Collector 1.40+, solves this by dynamically adjusting per-operation sampling probabilities to hit a target throughput while preserving 100% of error spans and low-latency paths by default.
How the controller works
The adaptive sampler runs inside the Jaeger Collector. It maintains a PID-like control loop that observes the incoming span rate per operation (service + operation name) and adjusts a sampling probability so the aggregate exported traces converge on a configured target_tps. Every refresh_interval (default 10s) the Collector recalculates probabilities and persists them to the storage backend. Because state lives in Cassandra, Elasticsearch, or OpenSearch, the control loop survives Collector restarts and horizontal scaling — ephemeral or in-memory backends like Badger cannot support this.
Two preservation rules sit on top of the controller:
- Error spans: any span with
error=trueis sampled aterror_sample_rate(default 1.0, i.e., 100%). - Low-latency operations: operations whose duration falls below a configurable
latency_thresholdbucket are sampled at 100% regardless of the computed probability.
This means a downstream service throwing 5xx responses or a hot path staying under 50ms remains fully visible even when the global sampling rate drops to 2%.
Configuration knobs that matter
The adaptive sampling block lives in the Collector YAML under sampling.adaptive. A minimal production-ready snippet:
sampling:\n adaptive:\n target_tps: 100 # global traces-per-second budget\n max_operations: 2000 # LRU cap on tracked operations\n refresh_interval: 10s # control loop period\n error_sample_rate: 1.0 # 1.0 = keep all errors\n latency_threshold: 50ms # keep sub-50ms ops at 100%\n service_strategies:\n payment-service:\n target_tps: 20 # dedicated budget for critical path\n error_sample_rate: 1.0\n checkout-service:\n target_tps: 10\n latency_threshold: 20ms
service_strategies lets you carve out per-service budgets so a high-volume, low-value service doesn't starve a low-volume, high-value one. The max_operations cap triggers LRU eviction; evicted operations fall back to the global probability and a warning appears in Collector logs.
Worked example: 50 services, 5k TPS raw → 100 TPS target
Assume a cluster averaging 5,000 raw traces/second across 50 services. Setting target_tps: 100 asks the controller to retain ~2% of traffic globally. Research indicates the PID loop converges in 2–3 refresh cycles (20–30 seconds). During convergence you'll see per-operation probabilities swing; after stabilization, error spans and any operation completing under 50ms remain at 100% sampling, while high-volume, high-latency operations settle near 0.02. The Jaeger UI will show roughly 100 traces/second ingested, with error traces and fast-path traces fully represented.
Trade-offs and operational gotchas
- Collector overhead: adaptive sampling adds ~15–20% CPU/memory at 10k tracked operations. Provision accordingly.
- Control-loop lag: bursty traffic can overshoot
target_tpsbefore the next refresh. If your traffic spikes 10x in under 10s, you'll temporarily ingest more than budgeted. - Cross-service completeness: upstream and downstream services sample independently. A trace may be captured in service A but dropped in service B, breaking end-to-end visibility for that request.
- Storage backend requirement: only Cassandra, Elasticsearch, and OpenSearch persist sampling state. Badger and in-memory backends lose coherence on restart.
- No client-side probabilistic sampling: running both on the same service wastes ingestion bandwidth and confuses probability math. Disable client-side probabilistic samplers when adaptive sampling is enabled.
- HPA thrashing: scaling Collector replicas on CPU causes state reload storms. Prefer fixed replica counts or scale on
jaeger_collector_queue_length.
Verification checklist
Enable sampling.adaptive.metrics in the Collector config to expose Prometheus gauges. Key queries:
jaeger_sampling_adaptive_probability— per-operation probability; should converge and stabilize.jaeger_sampling_adaptive_target_tps— confirms the configured target is active.rate(jaeger_collector_spans_received[1m]) / rate(jaeger_collector_spans_exported[1m])— observed sampling ratio; should approachtarget_tps / raw_tps.increase(jaeger_sampling_adaptive_error_sampled_total[5m])vs. application error logs — verifies error preservation.
Run a chaos test: kill one Collector replica mid-run. Remaining replicas should reload probabilities from storage within one refresh_interval without sampling spikes. Check Collector logs for WARN sampling.adaptive: evicted operation to monitor LRU pressure.
Adopt incrementally
- Deploy a test namespace with 3 instrumented services generating known load (e.g.,
hey -z 5m -c 10 http://svc). - Enable adaptive sampling with a conservative
target_tps: 50andrefresh_interval: 10s. - Plot
jaeger_sampling_adaptive_probabilityper operation over 10 minutes; confirm convergence. - Inject 5% 5xx responses; verify error sampling count matches injected errors.
- Compare trace completeness pre/post using
jaeger-queryAPI/api/traces?service=x&lookback=1hand count distinct traceIDs vs. application logs. - Roll out to production with per-service
service_strategiesfor critical paths.
Adaptive sampling turns trace volume from a budgeting crisis into a tunable parameter — without blinding you to the failures and latency regressions that matter most.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.