Research · December 2026
Tail sampling made our error rate read 9× high
Same spans, two error rates. A real OpenTelemetry Collector run shows what happens when an SLI is computed after a tail sampler, and the cheap fix.
If your error-rate or latency SLI is computed from traces after a tail sampler that keeps errors and slow requests, it grades a biased sample. The dashboard still looks plausible, which is exactly why nobody notices.
I wanted a number rather than an argument, so I ran it on a real collector.
The setup
Collector: otelcol-contrib 0.115.0. One pipeline sends every span to the spanmetrics connector: that’s the truth. A second pipeline runs tail_sampling first and then a second spanmetrics copy. That second copy is the anti-pattern, built in on purpose for comparison.
Tail-sampling policy, a common one: keep all errors, keep anything slower than 1 s, keep 10% of everything else.
Load: the Python OpenTelemetry SDK 1.28.2 sent about 40 requests per second for 15 minutes at 0.5% errors. During an incident in minutes 6 to 9, errors went to 3% and traffic to 1.6×. Prometheus 2.55.1 and Alertmanager 0.27.0 scraped and alerted; the rules passed promtool test rules.
What it showed
The collector refused 0 spans and the tail sampler decided 39,837 traces, keeping 4,310 (10.8%). Nothing was lost in transit. The distortion comes entirely from where the metric is computed.
- Error rate across the whole run: 1.19% before the sampler, 11.09% after.
- During the incident: 2.85–3.03% true, 21.1–23.1% after the sampler.
- In normal minutes: 0.17–0.95% true, 2.7–15.4% after the sampler. Every normal minute would have breached a 2% threshold.
- p99 latency: 628 ms true, 1,900 ms after the sampler.
Why it happens
The policy keeps 100% of errors and slow requests but only 10% of healthy, fast ones. Any ratio computed on the kept set over-weights exactly the things an SLI is meant to measure.
Fixes, in order of preference
1. Compute RED metrics before the sampler
Run the spanmetrics connector on a pipeline that sees 100% of spans, and sample only what you store:
service:
pipelines:
traces/all: # every span feeds the metrics, never sampled
receivers: [otlp]
exporters: [spanmetrics]
traces/sampled: # same spans, sampled for storage
receivers: [otlp]
processors: [tail_sampling, batch]
exporters: [otlp/traces-backend]
metrics/red:
receivers: [spanmetrics]
exporters: [prometheus]
2. If you must use sampled data, weight it
Each span kept only by the 10% rule stands for 10 requests. In a seeded simulation that accompanies this run, weighted counts gave 1.17% against a true 1.15%.
3. Test the alert path, not just the rule
A rule unit test passes on either number. Only a check against known input shows which number your alert actually reads.
A second finding I didn’t plan for
The correct rule (true metrics, rate(...[5m]), for: 2m, 2% threshold) fired once, at about minute 11: after the three-minute incident had already ended. A long rate window averages short incidents away, and for: delays what’s left. That’s the case for multi-window, multi-burn-rate SLO alerts, as described in the Google SRE Workbook’s chapter on alerting on SLOs.
Reproduce it
- Open data and config on GitHub: collector, Prometheus and Alertmanager config, alert rules and tests, load generator, raw results and the per-minute time series (text and data CC BY 4.0, config MIT)
- 1,233 Prometheus alert rules vs an OpenTelemetry migration
- Legacy monitoring to OpenTelemetry: naming and units cheat sheet
- Cutover Check: independent proof that critical alerts still reach a person before cutover