Skip to content
Latchkey

What Is Tail-Based Sampling?

Tail-based sampling buffers the spans of a trace until the request finishes, then evaluates the whole trace to decide whether to store it. Because the outcome is known, it can preferentially keep traces that erred or ran slowly and discard ordinary fast ones. The trade-off is the memory and coordination needed to hold spans until completion.

Why it matters

The most useful traces to keep are the problematic ones, but you only know which those are at the end. Tail-based sampling retains them on purpose rather than relying on luck.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →