Expand description
Metrics and observability for production monitoring
This module provides comprehensive metrics tracking for IPFRS operations, enabling production monitoring, performance analysis, and capacity planning.
§Features
- Operation Counters - Track blocks created, CIDs generated, bytes processed
- Performance Metrics - Latency percentiles, throughput rates
- Resource Usage - Memory allocations, pool hit rates
- Error Tracking - Error counts by type and category
- Health Checks - System health and readiness indicators
§Example
use ipfrs_core::metrics::{global_metrics, MetricsSnapshot};
// Record operations
let metrics = global_metrics();
metrics.record_block_created(1024);
metrics.record_cid_generated(50); // microseconds
// Get snapshot for monitoring
let snapshot = metrics.snapshot();
println!("Blocks created: {}", snapshot.blocks_created);
println!("Total bytes: {}", snapshot.total_bytes_processed);
println!("Avg CID generation: {:.2}µs", snapshot.avg_cid_generation_us);Structs§
- Metrics
- Core metrics collector for IPFRS operations
- Metrics
Snapshot - Snapshot of current metrics for reporting
- Percentile
Stats - Percentile statistics for latency analysis
- Timer
- Helper to measure operation duration
Statics§
- GLOBAL_
METRICS - Global metrics instance for the entire application
Functions§
- global_
metrics - Get the global metrics instance