const DefaultMaxQueueSize … const DefaultScheduleDelay … const DefaultExportTimeout … const DefaultMaxExportBatchSize … type BatchSpanProcessorOption … type BatchSpanProcessorOptions … type batchSpanProcessor … var _ … // NewBatchSpanProcessor creates a new SpanProcessor that will send completed // span batches to the exporter with the supplied options. // // If the exporter is nil, the span processor will perform no action. func NewBatchSpanProcessor(exporter SpanExporter, options ...BatchSpanProcessorOption) SpanProcessor { … } // OnStart method does nothing. func (bsp *batchSpanProcessor) OnStart(parent context.Context, s ReadWriteSpan) { … } // OnEnd method enqueues a ReadOnlySpan for later processing. func (bsp *batchSpanProcessor) OnEnd(s ReadOnlySpan) { … } // Shutdown flushes the queue and waits until all spans are processed. // It only executes once. Subsequent call does nothing. func (bsp *batchSpanProcessor) Shutdown(ctx context.Context) error { … } type forceFlushSpan … func (f forceFlushSpan) SpanContext() trace.SpanContext { … } // ForceFlush exports all ended spans that have not yet been exported. func (bsp *batchSpanProcessor) ForceFlush(ctx context.Context) error { … } // WithMaxQueueSize returns a BatchSpanProcessorOption that configures the // maximum queue size allowed for a BatchSpanProcessor. func WithMaxQueueSize(size int) BatchSpanProcessorOption { … } // WithMaxExportBatchSize returns a BatchSpanProcessorOption that configures // the maximum export batch size allowed for a BatchSpanProcessor. func WithMaxExportBatchSize(size int) BatchSpanProcessorOption { … } // WithBatchTimeout returns a BatchSpanProcessorOption that configures the // maximum delay allowed for a BatchSpanProcessor before it will export any // held span (whether the queue is full or not). func WithBatchTimeout(delay time.Duration) BatchSpanProcessorOption { … } // WithExportTimeout returns a BatchSpanProcessorOption that configures the // amount of time a BatchSpanProcessor waits for an exporter to export before // abandoning the export. func WithExportTimeout(timeout time.Duration) BatchSpanProcessorOption { … } // WithBlocking returns a BatchSpanProcessorOption that configures a // BatchSpanProcessor to wait for enqueue operations to succeed instead of // dropping data when the queue is full. func WithBlocking() BatchSpanProcessorOption { … } // exportSpans is a subroutine of processing and draining the queue. func (bsp *batchSpanProcessor) exportSpans(ctx context.Context) error { … } // processQueue removes spans from the `queue` channel until processor // is shut down. It calls the exporter in batches of up to MaxExportBatchSize // waiting up to BatchTimeout to form a batch. func (bsp *batchSpanProcessor) processQueue() { … } // drainQueue awaits the any caller that had added to bsp.stopWait // to finish the enqueue, then exports the final batch. func (bsp *batchSpanProcessor) drainQueue() { … } func (bsp *batchSpanProcessor) enqueue(sd ReadOnlySpan) { … } func (bsp *batchSpanProcessor) enqueueBlockOnQueueFull(ctx context.Context, sd ReadOnlySpan) bool { … } func (bsp *batchSpanProcessor) enqueueDrop(_ context.Context, sd ReadOnlySpan) bool { … } // MarshalLog is the marshaling function used by the logging system to represent this Span Processor. func (bsp *batchSpanProcessor) MarshalLog() interface{ … }