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 distributed tracing, and what is a span and a trace? [Advanced]
- What is the difference between the OpenTelemetry SDK and the Collector? [Advanced]
- What is cardinality cost, and how does it differ between metrics and logs? [Advanced]
- How do you build alerts in Wavefront, and what is a smart alert? [Advanced]
- How does Wavefront handle high-cardinality metrics compared to Prometheus? [Advanced]
- What is the Wavefront proxy, and why use it? [Advanced]
- What is Wavefront (Tanzu Observability), and what is it used for? [Advanced]
- How do you correlate logs and metrics during an incident? [Advanced]