jaegertracing/jaeger · error

failed to create the adaptive sampling aggregator: %w

Error message

failed to create the adaptive sampling aggregator: %w

What it means

This error wraps failures from adaptive.NewAggregator when the Jaeger OpenTelemetry collector tries to build the adaptive sampling aggregator during the trace processor's Start lifecycle phase. The aggregator coordinates probabilistic sampling calculations across Jaeger instances and needs a working distributed lock and sampling store; if its constructor cannot initialize these parts it returns an error, which this wrap decorates with context before failing processor startup.

Source

Thrown at cmd/jaeger/internal/processors/adaptivesampling/processor.go:50

func (tp *traceProcessor) start(_ context.Context, host component.Host) error {
	parts, err := remotesampling.GetAdaptiveSamplingComponents(host)
	if err != nil {
		return fmt.Errorf(
			"cannot load adaptive sampling components from `%s` extension: %w",
			remotesampling.ComponentType, err,
		)
	}

	agg, err := adaptive.NewAggregator(
		*parts.Options,
		tp.telset.Logger,
		otelmetrics.NewFactory(tp.telset.MeterProvider),
		parts.DistLock,
		parts.SamplingStore,
	)
	if err != nil {
		return fmt.Errorf("failed to create the adaptive sampling aggregator: %w", err)
	}

	agg.Start()
	tp.aggregator = agg

	return nil
}

func (tp *traceProcessor) close(context.Context) error {
	if tp.aggregator != nil {
		if err := tp.aggregator.Close(); err != nil {
			return fmt.Errorf("failed to stop the adaptive sampling aggregator : %w", err)
		}
	}
	return nil
}

func (tp *traceProcessor) processTraces(_ context.Context, td ptrace.Traces) (ptrace.Traces, error) {

View on GitHub (pinned to 806f444784)

Solutions

  1. Check that the jaeger_remote_sampling extension is configured and started before the processor, since start pulls DistLock and SamplingStore from it via remotesampling.GetAdaptiveSamplingComponents
  2. Inspect the wrapped inner error (%w) in the log — it names the actual root cause from adaptive.NewAggregator
  3. Verify the sampling storage backend (e.g. Cassandra/opensearch/memory) is reachable and its configuration is valid
  4. Confirm aggregator options from the extension config are sane (e.g. no negative/zero intervals)

Example fix

// before (extension missing -> aggregator cannot build)
service:
  extensions: []
  processors: [adaptivesampling]
// after
service:
  extensions: [jaeger_remote_sampling]
  processors: [adaptivesampling]
Defensive patterns

Strategy: validation

Validate before calling

parts, err := remotesampling.GetAdaptiveSamplingComponents(host)
if err != nil { return err }
if parts.DistLock == nil || parts.SamplingStore == nil {
    return fmt.Errorf("adaptive sampling components not ready: distLock=%v samplingStore=%v", parts.DistLock != nil, parts.SamplingStore != nil)
}

Type guard

if tp.aggregator == nil {
    return fmt.Errorf("adaptive sampling aggregator was not initialized")
}

Try / catch

if err := tp.start(ctx, host); err != nil {
    var inner error
    if errors.As(err, &inner) || true {
        logger.Error("adaptive sampling aggregator creation failed", log.Error(err))
    }
    return err // startup failure is not retryable in-place
}

Prevention

When it happens

Trigger: Calling start (via the OTel collector component lifecycle) when adaptive.NewAggregator returns an error — e.g. the remotesampling extension's DistLock or SamplingStore components are nil/misconfigured, or the aggregator options are invalid.

Common situations: Running `jaeger` binary with the adaptive sampling processor but without the remote sampling extension properly configured; sampling storage backend failing to initialize; misconfigured distributed lock (e.g. missing etcd/oteld connection settings); unit/integration tests exercising the error path.

Related errors


AI-assisted analysis of jaegertracing/jaeger@806f444784 (2026-09-01). Data as JSON: /api/errors/8346fb0fcf412878. Report an issue: GitHub.