How would you test a distributed-trace sampling strategy?
Answer
Start from investigation needs, traffic volume, cost and privacy constraints. Verify that the chosen head- or tail-sampling rules keep decisions consistent across a trace and retain enough errors, slow requests and representative normal traffic to answer operational questions. Exercise bursts, rare routes, retries, collector backpressure and configuration changes; compare kept and observed request counts, and document which conclusions are unsafe because sampling can bias the retained population.
Strong answer includes
- distinguishes head and tail decision tradeoffs
- tests rare failures and high-volume behaviour
- recognizes sampling bias
Practical example
The team switches from a flat 1% head-sampling rate to tail-based sampling that always keeps traces with errors or latency above 1 second. During testing, the QA engineer injects a burst of 10,000 requests with a 2% synthetic error rate and confirms nearly all erroring traces are retained, checks that the collector doesn't drop data or crash under the burst, and then verifies that a dashboard built purely from sampled traces no longer accurately estimates overall request volume, flagging that volume conclusions must come from metrics, not the sampled trace store.