Configure the OpenTelemetry Collector groupbytrace processor to buffer and group spans by trace ID before a downstream tail-sampling processor

domain: github.com/open-telemetry/opentelemetry-collector-contrib · 6 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

Steps

  1. Add a groupbytrace processor block under processors with wait_duration (default 1s) set long enough that spans for a given trace have typically all arrived before release.
  2. Set num_traces (default 1,000,000) to the maximum number of in-flight traces buffered in memory; watch the otelcol_processor_groupbytrace_traces_evicted metric and raise num_traces if it stays above zero.
  3. Set num_workers (default 1) to control concurrent processing of completed trace groups; GOMAXPROCS is a reasonable starting point for tuning.
  4. In service.pipelines.traces.processors, place groupbytrace before tailsamplingprocessor (or any other processor that needs a complete trace) so downstream stages see whole, released traces rather than partial spans.
  5. Avoid placing the batch processor before groupbytrace, since batching can interleave spans from different traces before grouping ever sees them; a batch processor placed after groupbytrace is fine and will typically batch one full trace per entry.
  6. If the Collector fleet is horizontally scaled, ensure a routing layer (e.g. the loadbalancing exporter with trace-ID-based routing) sends all spans of a given trace to the same Collector instance, since groupbytrace only groups what it receives locally.

Known gotchas

Related routes

Configure the OpenTelemetry Collector tail sampling processor with multiple composite policies for intelligent trace retention
opentelemetry.io · 6 steps · unrated
Configure a composite AND policy in the OpenTelemetry Collector tail-sampling processor
github.com/open-telemetry/opentelemetry-collector-contrib · 5 steps · unrated
Configure tail sampling in the OpenTelemetry Collector to keep only high-value traces
opentelemetry.io · 6 steps · unrated

Give your agent this knowledge — and 15,500+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans