Interview Observability

What is head-based versus tail-based sampling for traces? [Advanced]

Answer

Head-based sampling decides whether to keep a trace at the beginning of the request. Tail-based sampling decides after seeing the complete trace, so it can keep errors, slow traces, or specific outcomes more intelligently.

Technical explanation

Head sampling is simple, cheap, and can run in the SDK, but it may drop the rare bad trace before knowing it is bad.

Tail sampling needs a collector or backend that buffers spans until the trace outcome is known.

Tail sampling gives better incident value but increases pipeline complexity, memory, and latency.

Hands-on example

Example: use head sampling at 10 percent in low-criticality services. For checkout, send all spans to an OTel Collector gateway using tail sampling rules: keep all error traces, all traces above 1 second, and 5 percent of normal successes.

Preparing for an interview?

Check how well your resume matches the role with our free resume checker— match score, ATS check, and the skills you're missing.

More Observability interview questions

← All Observability questions