What is Refinery and how does tail sampling work?
mainRefinery is a tail-based sampling proxy for Honeycomb. Unlike head sampling, which makes a decision at the start of a trace, Refinery examines entire traces to make intelligent sampling decisions. This allows you to keep traces based on their content (e.g., keeping all traces that contain a 500 error or specific cache status) while dropping less useful data to manage volume.
Refinery supports several sampling techniques:
- Dynamic sampling: Automatically adjusts sampling rates based on the frequency of unique values in a trace field (e.g., sampling 100% of
5xxerrors but only 0.1% of2xxsuccesses). - Rules-based sampling: Defines specific sampling rates for well-known conditions (e.g., 'keep 100% of traces with an error').
- Throughput-based sampling: Maintains a fixed upper bound for spans per second by dynamically adjusting the sampling rate.
- Deterministic probability sampling: Applies decisions based solely on the trace ID, ensuring consistent sampling without inspecting trace content.