Head-based sampling, also called up-front sampling, decides whether to emit a trace at the beginning of a request, typically at its root span. The decision is simple and must be propagated globally across the request. section 2.5.3 section 8.3.1
Use it when a straightforward sampling policy and controlled network cost matter:
- An agent can discard a fixed number of traces before downstream services emit their spans. section 2.5.3
- The trade-off is visibility: because downstream errors and anomalies are not yet known, valuable traces may be discarded. section 8.3.1
- Compared with tail-based sampling, the approach uses less state and usually reduces setup and resource complexity. section 2.5.3
A distributed request
A root span makes the capture decision before a request reaches several downstream services. If a later service fails, the trace is unavailable when the initial decision discarded it; if retained, its spans can be collected across the request path. section 8.3.1
Table 2.3 Overview of the costs of traces (view table figure)
| Lots of commercial offerings and some OSS (e.g., Tempo and Jaeger) |
Use the trace-cost overview to compare agent sampling overhead with instrumentation and destination costs. section 2.5.3
