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.
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
- What is observability, and how is it different from traditional monitoring? [Basic]
- What are the three pillars of observability (metrics, logs, traces)? [Basic]
- What is the difference between monitoring and observability in practice? [Basic]
- What are the four golden signals of monitoring? [Basic]
- What is the difference between the USE method and the RED method? [Basic]
- When would you use the USE method versus the RED method? [Basic]
- What is an SLI, an SLO, and an SLA, and how do they relate? [Basic]
- How do you choose good SLIs for a service? [Basic]