QuickDevGuide

Home › OpenTelemetry (Observability)

Sampling Strategies — OpenTelemetry (Observability)

Recording every span is expensive at scale. Sampling keeps a representative subset. Strategy Where Pros Cons AlwaysOn SDK complete data cost at high volume TraceIdRatio (e.g. 10%) SDK (head) cheap, decided at the start may drop rare errors ParentBased SDK follows the caller's decision → complete traces needs a root decision Tail sampling Collector (gateway) keep all errors and slow traces, sample the rest needs all spans of a trace in one collector, more memory Practical setup SDK: parentbasedtraceidratio with a modest ratio (or 100% and sample in the collector). Gateway collector: tail sampling policies — keep errors, keep latency > threshold, keep 5–10% of the rest. Route spans of a trace to the same gateway instance with the loadbalancing exporter (by trace ID). Never sample metrics…

Key Takeaways