OTEL-043: Batch before tail_sampling/groupbytrace
Severity: warn (advisory)
Rule Details
tail_sampling and groupbytrace both need to see all spans for a trace in the same processor instance to make a correct decision. If batch runs first, it can put spans from the same trace into different batches — and spans from different batches arrive at the sampler at different times, sometimes after the sampler's decision window has already closed. Run trace-aware processors before batch.
This rule fires when a pipeline contains batch and a tail_sampling or groupbytrace processor appearing after it.
Options
This rule has no options.
Examples
Avoid
service:
pipelines:
traces:
receivers: [otlp]
processors: [memory_limiter, batch, tail_sampling]
exporters: [otlp/backend]
Prefer
service:
pipelines:
traces:
receivers: [otlp]
processors: [memory_limiter, groupbytrace, tail_sampling, batch]
exporters: [otlp/backend]
When Not To Use It
Never for tail_sampling or groupbytrace — it will produce incorrect sampling decisions.
Related Rules
- OTEL-013 —
batchprocessor should be last in pipeline - OTEL-038 — filter processor after batch
- OTEL-039 — transform/attributes processor after batch
- OTEL-063 —
tail_samplingwithoutgroupbytrace - OTEL-064 — both
probabilistic_samplerandtail_samplingin same pipeline
Version
Available since augur v0.1.0.
Further Reading
- OpenTelemetry Collector Contrib — tail_sampling processor
- OpenTelemetry Collector Contrib — groupbytrace processor
Resources
- Rule source:
policy/main/pipeline.rego