The Trace Sampling Decision: Cost Per Decision
Each sampling decision has a cost. Head sampling is cheap; tail sampling is expensive. The math that picks the right approach.
Head sampling
Decision at trace start. Cheap: random number, threshold compare.
Cost: nearly zero. Quality: drops error/slow traces probabilistically.
Tail sampling
Decision after full trace. Expensive: buffer all spans, evaluate rules, decide retention.
Cost: collector memory + CPU. Quality: keeps error/slow traces deterministically.
Hybrid
Head sample 10% of healthy traces. Tail sample 100% of error/slow traces.
Best of both. Most production stacks converge here.