How do you configure tail sampling in the Collector?
AdvancedConceptTracing & OpenTelemetry
Answer
processors:
tail_sampling:
decision_wait: 10s
num_traces: 100000
expected_new_traces_per_sec: 2000
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 says sample (use and / composite policies for more control). decision_wait must be longer than your typical trace duration; num_traces bounds memory. Spans of one trace must reach the same Collector, so front the tail-sampling tier with the loadbalancing exporter using routing_key: traceID. Watch otelcol_processor_tail_sampling_sampling_trace_dropped_too_early to detect an undersized buffer.
More on Tracing & OpenTelemetry
What is distributed tracing, and what are a trace, a span and a span context?BeginnerWhat fields does an OpenTelemetry span carry?BeginnerWhat are span kinds and why do they matter?IntermediateWhat does the W3C `traceparent` header look like?IntermediateWhat is baggage, and how is it different from span attributes?IntermediateWhat is OpenTelemetry and what are its main parts?Beginner