BatchSpanProcessor class

A SpanProcessor that batches spans before export.

This processor collects finished spans in a queue and exports them in batches at regular intervals, improving efficiency compared to exporting each span individually. Spans are added to a queue when they end, and periodically sent to the configured exporter in batches according to the configured schedule.

The batch behavior can be tuned using BatchSpanProcessorConfig to control batch size, queue limits, and export timing.

Implemented types

Constructors

BatchSpanProcessor(SpanExporter exporter, [BatchSpanProcessorConfig? config])
Creates a new BatchSpanProcessor with the specified exporter and configuration.

Properties

exporter → SpanExporter
The exporter used to send spans to the backend
final
hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

forceFlush() → Future<void>
Forces the span processor to flush any queued spans.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onEnd(Span span) → Future<void>
Called when a span is ended.
override
onNameUpdate(Span span, String newName) → Future<void>
Called when a span's name is updated.
override
onStart(Span span, Context? parentContext) → Future<void>
Called when a span is started.
override
shutdown() → Future<void>
Shuts down the span processor.
override
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited