class

Logit::Backend::OTLP::BatchProcessor

Inherits Reference / Object

Batches events and flushes them periodically or when size threshold is reached.

The batch processor uses a background fiber for interval-based flushing and provides thread-safe event buffering.

Constructors

new(batch_size : Int32, flush_interval : Time::Span, &on_flush : Array(Event) -> Nil)
Source

Instance methods

add(event : Event) : Nil

Adds an event to the buffer.

If the buffer reaches the batch size, flushes immediately.

Source
flush

Forces an immediate flush of buffered events.

Source
start

Starts the background flush fiber.

Must be called before adding events.

Source
stop

Stops the batch processor and flushes remaining events.

Source