head-based sampling
also: head sampling
A performance monitoring technique that analyzes only the first N requests or events in a stream, rather than all of them, to reduce overhead while maintaining statistical validity.
Head-based sampling is a method used in distributed tracing and logging systems to keep only the initial portion of requests or events for analysis. Instead of processing and storing every single request, the system records decisions about sampling early—often at the entry point of a request—and applies that decision consistently across all related operations.
This approach is common in tools like Jaeger, Zipkin, and OpenTelemetry. For example, a service might sample only the first 10% of incoming HTTP requests. Once a request is marked as sampled at the head (entry point), all downstream services are informed and will also trace that request, ensuring complete traces.
Head-based sampling differs from tail-based sampling, where decisions are made after seeing all the data. Head-based is simpler to implement and requires less context, making it efficient for high-throughput systems, though it cannot preferentially capture rare or interesting events that only become apparent later in processing.