n. / Tracing basics
Definition
Trace sampling is recording only a share of all traces, chosen by a rule, to keep storage and cost down. Head sampling decides when a trace starts; tail sampling decides after it finishes, so it can keep every failure.
In more detail
Sampling is a trade-off between cost and visibility. A fixed percentage is simple but can drop the one run that failed. Teams often keep all errors and all slow runs and sample the healthy rest. Whatever you choose, record the sampling rate so counts and totals can be scaled back up honestly.
Example
An agent handles 2 million requests a month. You keep 100% of runs with errors, 100% of runs slower than 20 seconds, and 5% of everything else.
