How do you set up tail sampling in the OpenTelemetry Collector?
IntermediateProductionTracing & Sampling
Answer
processors:
tail_sampling:
decision_wait: 10s
num_traces: 100000
policies:
- name: errors
type: status_code
status_code: { status_codes: [ERROR] }
- name: slow
type: latency
latency: { threshold_ms: 1000 }
- name: baseline
type: probabilistic
probabilistic: { sampling_percentage: 5 }
A trace is kept if any policy matches. decision_wait must cover your longest normal trace; num_traces bounds memory. Watch otelcol_processor_tail_sampling_sampling_trace_dropped_too_early.
More on Tracing & Sampling
In production, when do you pick tail-based over head-based trace sampling, and what does it cost you?BeginnerHow do you configure head sampling correctly in OpenTelemetry?BeginnerWhy does tail sampling need a load-balancing tier, and how do you build it?AdvancedHow do you combine head and tail sampling in a high-traffic system?AdvancedHow do you get accurate RED metrics if traces are sampled?IntermediateWhat should you put in span attributes and what should you avoid?Beginner