Engineering Decisions · Senior · Question 14 of 14
Storing every trace costs too much, but during incidents you need the errors and slow requests above all. How do you sample?
- 1Keep logs only and turn tracing off entirely
- 2Tail-based: decide after the request has finished
- 3Head-based: keep a random 1% of all requests
Show the answer
Correct answer: Tail-based: decide after the request has finished
Explanation
Tail-based sampling sees how a request ended, so it can keep every error and slow trace and drop the routine ones. Head-based sampling fits cheap overall statistics, and it's simple to run, but a random 1% misses most rare failures. Logs alone fit one small service, and they lose the cross-service view that tracing exists to give.