sampling
What is sampling?
sampling: Keeping only a fraction of traces/logs to control cost. Head sampling decides up front; tail sampling decides after seeing the whole trace. Sampling means keeping only part of your traces or logs to control cost and volume. Storing every trace from a busy service can be very expensive, and most of them look the same.
Frequently asked questions about sampling
How is sampling used in practice?
Head sampling decides at the start of a request, for example keeping one percent. It is cheap but random, so it may drop the rare interesting ones. Tail sampling decides after the request finishes, so you can keep every error and every slow request while sampling the normal ones.
What should you keep in mind with sampling?
A practical rule is to keep all errors and slow requests, and a small share of healthy traffic. The OpenTelemetry Collector supports tail sampling. Metrics should not be sampled this way; they are cheap and you want complete numbers. Make sure dashboards that count from traces account for the sample rate.
What does an example of sampling look like?
sample 100% of errors, 1% of healthy traces At a glance
| Category | Observability |
|---|---|
| Explained by | Reinier de la Parra |
| Updated |