class Logit::Backend::OTLP::BatchProcessor

Overview

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.

Defined in:

logit/backends/otlp/batch_processor.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(batch_size : Int32, flush_interval : Time::Span, &on_flush : Array(Event) -> Nil) #

[View source]

Instance Method Detail

def add(event : Event) : Nil #

Adds an event to the buffer.

If the buffer reaches the batch size, flushes immediately.


[View source]
def flush : Nil #

Forces an immediate flush of buffered events.


[View source]
def start : Nil #

Starts the background flush fiber.

Must be called before adding events.


[View source]
def stop : Nil #

Stops the batch processor and flushes remaining events.


[View source]