Guidelines for why and when to sample your telemetry data.
Some of the main reasons to sample data include:
You should consider sampling if:
If you have a lot of data, but it is fairly uniform or it is not critical you capture everything, then you can use a simple sampling strategy. If you have a lot of conditions that matter to you, or irregular traffic patterns across your services, then you will need a more sophisticated sampling strategy.
Head sampling is a blunt instrument. It is simple to configure and requires no additional infrastructure or operational overhead.
But what head sampling offers in simplicity, it loses in flexibility:
To accomplish the above, you need to use tail sampling instead.
Tail sampling with Refinery lets you sample traces in just about any way you can imagine. How you configure tail sampling depends on your needs and the complexity of your system.
Most people tend to follow some common patterns:
http.status_code
to sample traces proportionally across all values of that keyThe rules and key configuration will often have to take into account attributes that are unique to your system.
The flexibility and sophistication of tail sampling comes at a price: it is more effort to configure and requires additional infrastructure and operational overhead to run. For extremely high-volume systems, you may also need to combine head sampling and tail sampling to protect your infrastructure from huge spikes of data.