Flow PHP

BatchingSpanProcessor implements SpanProcessor

FinalYes

Batches spans for efficient export.

Collects spans in memory and exports them in batches when:

  • The batch size limit is reached
  • flush() is explicitly called
  • the system is shutting down

Example usage:

$processor = new BatchingSpanProcessor(
    exporter: $spanExporter,
    batchSize: 100,
);

Interfaces

SpanProcessor
Interface for processing spans when they start and end.

Methods

__construct()  : mixed
exporter()  : SpanExporter
Get the exporter used by this processor.
flush()  : bool
Export all pending spans and return success status.
onEnd()  : void
Called when a span ends.
onStart()  : void
Called when a span starts.

Methods

flush()

Export all pending spans and return success status.

public flush() : bool

Forces immediate export of any buffered spans. Returns true if all spans were successfully exported.

Return values
bool

onEnd()

Called when a span ends.

public onEnd(Span $span) : void

This is invoked synchronously when the span completes. The span is fully populated at this point (end time, status, all attributes).

Parameters
$span : Span

onStart()

Called when a span starts.

public onStart(Span $span) : void

This is invoked synchronously when the span begins. Implementations should avoid blocking operations in this method.

Parameters
$span : Span

        
On this page

Search results