Trace sampling
Trace sampling means a system records only some of its traces, so that storage and the tracing backend can keep up. With head sampling, the keep-or-drop decision is made when the request starts. With tail sampling, it waits until the trace is complete and looks at what happened, such as an error or high latency.
How it works
With head sampling at 10%, a service handling 1,000 traces per second keeps about 100, chosen at random by trace ID. It is cheap, but it drops most rare errors.
Tail sampling, for example the tail_sampling processor in the OpenTelemetry Collector, buffers spans for a decision window such as 20 seconds. When the window closes, it keeps every trace with an error and every trace slower than 2 seconds, plus a small random share of everything else. All spans of a trace must reach the same Collector instance, so gateways usually route by trace ID.
Why it matters in production
At 1,000 traces per second, keeping everything means storing and indexing every one of them. A 10% head sample cuts that to about 100, but the trace for the one failed request you are chasing during an incident is probably among the 900 dropped. Tail sampling keeps error and slow traces by policy. In exchange, the Collector holds 20 seconds of spans in memory, and the gateways in front of it have to route by trace ID.
See also
On the One2N blog
References

Putting this into practice?