Skip to main content

BatchingPort

Trait BatchingPort 

Source
pub trait BatchingPort: Send + Sync {
    // Required methods
    fn add_to_batch(&self, entry: LogEntry) -> ObservabilityResult<()>;
    fn flush_batch(&self) -> ObservabilityResult<()>;
    fn batch_size(&self) -> usize;
}
Expand description

Port for batching log entries

This allows different batching strategies:

  • TimeBasedBatcher (flush every N seconds)
  • SizeBasedBatcher (flush when buffer reaches N entries)
  • HybridBatcher (combination of time and size)

Required Methods§

Source

fn add_to_batch(&self, entry: LogEntry) -> ObservabilityResult<()>

Add an entry to the batch

Source

fn flush_batch(&self) -> ObservabilityResult<()>

Force flush the current batch

Source

fn batch_size(&self) -> usize

Get current batch size

Implementors§