performance
Performance optimization features for structured logging
Structs
Section titled “Structs”PerformanceStats
Section titled “PerformanceStats”Performance statistics for monitoring optimization impact
Fields
| Field | Type | Description |
|---|---|---|
entries_processed | u64 | Total entries processed |
fast_path_time | web_time::Duration | Total time spent in fast paths |
standard_path_time | web_time::Duration | Total time spent in standard paths |
string_interner_hits | u64 | Number of string interning hits |
string_interner_misses | u64 | Number of string interning misses |
buffer_pool_hits | u64 | Buffer pool hits |
buffer_pool_misses | u64 | Buffer pool misses (new allocations) |
bytes_written | u64 | Total bytes written |
avg_processing_time_ns | u64 | Average entry processing time |
Methods
string_interner_hit_ratio
Section titled “string_interner_hit_ratio”fn string_interner_hit_ratio(&self) -> f64Calculate string interning hit ratio
buffer_pool_hit_ratio
Section titled “buffer_pool_hit_ratio”fn buffer_pool_hit_ratio(&self) -> f64Calculate buffer pool hit ratio
fast_path_ratio
Section titled “fast_path_ratio”fn fast_path_ratio(&self) -> f64Calculate fast path usage ratio
StringInterningProcessor
Section titled “StringInterningProcessor”String interner for common log field values
Methods
fn new(capacity: usize) -> Result<Self>intern_string
Section titled “intern_string”fn intern_string(&self, value: &str) -> Result<String>process_entry
Section titled “process_entry”fn process_entry(&self, entry: LogEntry) -> Result<LogEntry>BufferPool
Section titled “BufferPool”Buffer pool for reusing formatting buffers
Methods
fn new(pool_size: usize, buffer_capacity: usize) -> Selfget_buffer
Section titled “get_buffer”fn get_buffer(&self) -> Result<Vec<u8>>return_buffer
Section titled “return_buffer”fn return_buffer(&self, buffer: Vec<u8>) -> Result<()>FastPathLogger
Section titled “FastPathLogger”Fast path logger for hot code paths with minimal allocations
Methods
fn new(config: &PerformanceConfig) -> Result<Self>log_llm_request_fast
Section titled “log_llm_request_fast”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
log_a2a_message_fast
Section titled “log_a2a_message_fast”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
OptimizedWasmStdoutAdapter
Section titled “OptimizedWasmStdoutAdapter”Optimized WASM stdout adapter with performance enhancements
Methods
fn new(config: PerformanceConfig) -> Result<Self>write_entry_optimized
Section titled “write_entry_optimized”fn write_entry_optimized(&self, entry: &LogEntry) -> Result<()>Write log entry using fast path if possible
get_stats
Section titled “get_stats”fn get_stats(&self) -> Result<PerformanceStats>PerformanceManager
Section titled “PerformanceManager”Performance manager that coordinates all optimization features
Methods
fn new(config: &PerformanceConfig) -> Result<Self>process_entry
Section titled “process_entry”fn process_entry(&self, entry: LogEntry) -> Result<LogEntry>get_stats
Section titled “get_stats”fn get_stats(&self) -> PerformanceStatsreset_stats
Section titled “reset_stats”fn reset_stats(&self) -> Result<()>