package batchtraces

import (
	
	

	
)

const (
	defaultMaxBatch      = 512
	defaultMaxExports    = 4
	defaultFlushInterval = 5 * time.Second
)

// Options is a set of options for [Batcher] constructor.
type Options struct {
	// Clock is the clock to use for periodic flush timers.
	// Defaults to [clock.System].
	Clock *clock.Clock

	// FlushInterval is the time interval for periodic flushing.
	// Defaults to 5s.
	FlushInterval time.Duration

	// MaxBatch is the maximum number of spans per export batch and the
	// threshold that triggers an immediate flush.
	// Defaults to 512.
	MaxBatch int

	// MaxExports is the maximum number of concurrent export calls in flight.
	// When all export slots are busy, new flushes drop the batch and count
	// the spans in [Stats.Dropped].
	// Defaults to 4.
	MaxExports int

	// OnError specifies a callback invoked when [Exporter.Export] returns
	// a non-nil error. If not set, export errors are ignored and still
	// counted in [Stats.Failed].
	OnError func(context.Context, error)
}

// setDefaults sets default values for unspecified options.
func ( *Options) () {
	if .Clock == nil {
		.Clock = clock.System()
	}
	if .FlushInterval <= 0 {
		.FlushInterval = defaultFlushInterval
	}
	if .MaxBatch <= 0 {
		.MaxBatch = defaultMaxBatch
	}
	if .MaxExports <= 0 {
		.MaxExports = defaultMaxExports
	}
}