Sampling applies to traces. Logs are reduced by log level and by
filtering; metrics are aggregates and are not sampled — dropping metric
samples changes the values rather than the volume of evidence. See
Reducing what you store.
The rule that matters most
Head sampling
The decision is made when the trace starts, before anything is known about how it went.Head sampling is cheap and unavoidably ignorant. It costs nothing —
nothing is generated, buffered or transmitted for a dropped trace — but it
decides before knowing whether the request errored or took nine seconds. At
10%, nine out of ten of your incidents are gone.That is the trade. Use it when volume is the binding constraint and you
accept losing individual examples.
Tail sampling
The decision is made after the trace completes, in a Collector, when its outcome is known. This is what most teams actually want.decision_wait of latency before
export — bounded by num_traces, which is a cap you should set deliberately
rather than leave at a default.
Choosing
1
Start with no sampling
Until volume is a real problem, sample nothing. Sampling a system you do
not yet understand hides the thing you were about to learn.
2
Then filter before you sample
Dropping health checks and metrics scrapes is free and loses nothing. It is
frequently a larger reduction than sampling would have been. See
Collector configuration.
3
Then tail sample
Keep all errors, keep the slow tail, take a small baseline of the rest.
4
Use head sampling only if the volume leaving your app is the problem
A network or CPU constraint at the application, rather than a storage one.
What sampling does to your other data
Log-to-trace links also break for dropped traces: the log line still carries a trace id, and clicking through finds nothing. That is expected and is not a bug — it is the cost of the trace you chose not to keep.Verify
After changing sampling, confirm the shape rather than assuming it:- Trace volume should fall roughly as expected within a few minutes.
- Error traces should still be present. Cause a failure and look for it. This is the check that catches a tail-sampling policy that silently is not matching.
- Traces should still be complete. Open one and confirm it has spans from every service you expect, not a hole in the middle.
Next
Collector configuration
Where tail sampling and filtering live.
Exporters
Batching, retries and queueing — what happens to a dropped export.
Data retention
The other half of controlling volume.