Skip to content

performance

Performance optimization features for structured logging

Performance statistics for monitoring optimization impact

Fields

FieldTypeDescription
entries_processedu64Total entries processed
fast_path_timeweb_time::DurationTotal time spent in fast paths
standard_path_timeweb_time::DurationTotal time spent in standard paths
string_interner_hitsu64Number of string interning hits
string_interner_missesu64Number of string interning misses
buffer_pool_hitsu64Buffer pool hits
buffer_pool_missesu64Buffer pool misses (new allocations)
bytes_writtenu64Total bytes written
avg_processing_time_nsu64Average entry processing time

Methods

fn string_interner_hit_ratio(&self) -> f64

Calculate string interning hit ratio

fn buffer_pool_hit_ratio(&self) -> f64

Calculate buffer pool hit ratio

fn fast_path_ratio(&self) -> f64

Calculate fast path usage ratio

String interner for common log field values

Methods

fn new(capacity: usize) -> Result<Self>
fn intern_string(&self, value: &str) -> Result<String>
fn process_entry(&self, entry: LogEntry) -> Result<LogEntry>

Buffer pool for reusing formatting buffers

Methods

fn new(pool_size: usize, buffer_capacity: usize) -> Self
fn get_buffer(&self) -> Result<Vec<u8>>
fn return_buffer(&self, buffer: Vec<u8>) -> Result<()>

Fast path logger for hot code paths with minimal allocations

Methods

fn new(config: &PerformanceConfig) -> Result<Self>
fn log_llm_request_fast(&self, model: &str, duration_ms: u64, tokens: u32, status: &str) -> Result<Vec<u8>>

Fast path for LLM request logging with minimal allocations

fn log_a2a_message_fast(&self, message_type: &str, from_agent: &str, to_agent: &str, duration_ms: Option<u64>) -> Result<Vec<u8>>

Fast path for A2A message logging

Optimized WASM stdout adapter with performance enhancements

Methods

fn new(config: PerformanceConfig) -> Result<Self>
fn write_entry_optimized(&self, entry: &LogEntry) -> Result<()>

Write log entry using fast path if possible

fn get_stats(&self) -> Result<PerformanceStats>

Performance manager that coordinates all optimization features

Methods

fn new(config: &PerformanceConfig) -> Result<Self>
fn process_entry(&self, entry: LogEntry) -> Result<LogEntry>
fn get_stats(&self) -> PerformanceStats
fn reset_stats(&self) -> Result<()>