pub struct V2WALMetrics { /* private fields */ }Expand description
V2 WAL performance metrics collection specifically for graph operations.
This is the main metrics collector that coordinates all performance monitoring for V2 clustered edge graph operations, providing comprehensive tracking of throughput, latency, and resource utilization.
§Examples
use crate::backend::native::v2::wal::metrics::core::V2WALMetrics;
let metrics = V2WALMetrics::new();
metrics.record_write_operation(100, 50, Some(42), "edge_insert");
let counters = metrics.get_counters();
assert_eq!(counters.records_processed, 1);Implementations§
Source§impl V2WALMetrics
impl V2WALMetrics
Sourcepub fn new() -> Self
pub fn new() -> Self
Create new metrics collector for V2 WAL graph operations.
Initializes all metric tracking components with default values and prepares the collector for comprehensive performance monitoring.
§Returns
A new V2WALMetrics instance ready to collect performance data.
§Examples
use crate::backend::native::v2::wal::metrics::core::V2WALMetrics;
let metrics = V2WALMetrics::new();
// Ready to collect metricsSourcepub fn get_counters(&self) -> WALPerformanceCounters
pub fn get_counters(&self) -> WALPerformanceCounters
Get current performance counters.
Returns a snapshot of all current performance metrics including operation counts, latencies, and resource utilization.
§Returns
A clone of the current WALPerformanceCounters.
Sourcepub fn get_latency_histogram(&self) -> LatencyHistogram
pub fn get_latency_histogram(&self) -> LatencyHistogram
Get current latency histogram.
Returns the current latency distribution data for all operation types, including write, read, flush, and checkpoint operations.
§Returns
A clone of the current LatencyHistogram.
Sourcepub fn get_throughput_tracker(&self) -> ThroughputTracker
pub fn get_throughput_tracker(&self) -> ThroughputTracker
Get current throughput metrics.
Returns time-windowed throughput data including records per second, bytes per second, and transactions per second.
§Returns
A clone of the current ThroughputTracker.
Sourcepub fn get_resource_tracker(&self) -> ResourceTracker
pub fn get_resource_tracker(&self) -> ResourceTracker
Get current resource utilization.
Returns current resource usage metrics including memory, CPU, disk I/O, and other system-level performance indicators.
§Returns
A clone of the current ResourceTracker.
Sourcepub fn get_cluster_metrics(&self) -> ClusterPerformanceMetrics
pub fn get_cluster_metrics(&self) -> ClusterPerformanceMetrics
Get cluster performance metrics.
Returns detailed performance metrics for individual clusters including access patterns, efficiency scores, and utilization data.
§Returns
A clone of the current ClusterPerformanceMetrics.
Sourcepub fn get_error_tracker(&self) -> ErrorTracker
pub fn get_error_tracker(&self) -> ErrorTracker
Get error tracker data.
Returns current error tracking data including error counts, rates, and recent error entries for analysis.
§Returns
A clone of the current ErrorTracker.
Sourcepub fn get_global_counters(&self) -> (u64, u64, u64, u64, usize)
pub fn get_global_counters(&self) -> (u64, u64, u64, u64, usize)
Get global counter values.
Returns the current values of all global atomic counters in a single atomic operation for consistency.
§Returns
A tuple containing (records_written, records_read, bytes_written, bytes_read, active_operations).
Source§impl V2WALMetrics
impl V2WALMetrics
Sourcepub fn record_write_operation(
&self,
record_size_bytes: usize,
latency_us: u64,
cluster_key: Option<i64>,
operation_type: &str,
)
pub fn record_write_operation( &self, record_size_bytes: usize, latency_us: u64, cluster_key: Option<i64>, operation_type: &str, )
Record a write operation for V2 graph operations.
This method captures comprehensive performance data for write operations including latency, size, cluster affinity, and operation type. It updates all relevant metrics components in a coordinated manner.
§Arguments
record_size_bytes- Size of the record being written in byteslatency_us- Operation latency in microsecondscluster_key- Optional cluster ID for cluster-affinity trackingoperation_type- Type of operation (e.g., “edge_insert”, “node_update”)
§Examples
use crate::backend::native::v2::wal::metrics::core::V2WALMetrics;
let metrics = V2WALMetrics::new();
metrics.record_write_operation(100, 50, Some(42), "edge_insert");Sourcepub fn record_read_operation(
&self,
record_size_bytes: usize,
latency_us: u64,
cluster_key: Option<i64>,
operation_type: &str,
)
pub fn record_read_operation( &self, record_size_bytes: usize, latency_us: u64, cluster_key: Option<i64>, operation_type: &str, )
Record a read operation for V2 graph operations.
Captures comprehensive performance data for read operations similar to write operations but optimized for read-specific metrics and patterns.
§Arguments
record_size_bytes- Size of the record being read in byteslatency_us- Operation latency in microsecondscluster_key- Optional cluster ID for cluster-affinity trackingoperation_type- Type of operation (e.g., “edge_read”, “node_lookup”)
§Examples
use crate::backend::native::v2::wal::metrics::core::V2WALMetrics;
let metrics = V2WALMetrics::new();
metrics.record_read_operation(150, 30, Some(42), "edge_read");Sourcepub fn record_error(
&self,
error_type: &str,
message: &str,
operation_context: &str,
recovery_action: &str,
)
pub fn record_error( &self, error_type: &str, message: &str, operation_context: &str, recovery_action: &str, )
Record an error occurrence.
Captures detailed error information for analysis and monitoring. This method tracks error patterns, frequencies, and recovery actions to help identify systematic issues and performance bottlenecks.
§Arguments
error_type- Type or category of the errormessage- Detailed error messageoperation_context- Context in which the error occurredrecovery_action- Action taken to recover from the error
§Examples
use crate::backend::native::v2::wal::metrics::core::V2WALMetrics;
let metrics = V2WALMetrics::new();
metrics.record_error(
"IOError",
"Disk write failed",
"edge_insertion",
"retry_operation"
);