pub struct SyncModeMetrics {
pub total_syncs: u64,
pub full_history_syncs: u64,
pub latest_only_syncs: u64,
pub windowed_syncs: u64,
pub full_history_bytes: u64,
pub latest_only_bytes: u64,
pub windowed_bytes: u64,
pub full_history_duration_ms: u64,
pub latest_only_duration_ms: u64,
pub windowed_duration_ms: u64,
}Expand description
Metrics for sync mode performance tracking
Provides statistics on sync operations by mode, enabling analysis of the ~300× reconnection improvement from LatestOnly mode.
§Example
use peat_mesh::sync::types::SyncModeMetrics;
use peat_mesh::qos::SyncMode;
let mut metrics = SyncModeMetrics::new();
metrics.record_sync("beacons", SyncMode::LatestOnly, 1024, std::time::Duration::from_millis(5));
assert_eq!(metrics.total_syncs, 1);
assert_eq!(metrics.latest_only_syncs, 1);Fields§
§total_syncs: u64Total number of sync operations
full_history_syncs: u64Number of syncs using FullHistory mode
latest_only_syncs: u64Number of syncs using LatestOnly mode
windowed_syncs: u64Number of syncs using WindowedHistory mode
full_history_bytes: u64Total bytes synced with FullHistory mode
latest_only_bytes: u64Total bytes synced with LatestOnly mode
windowed_bytes: u64Total bytes synced with WindowedHistory mode
full_history_duration_ms: u64Total sync duration (in milliseconds) for FullHistory
latest_only_duration_ms: u64Total sync duration (in milliseconds) for LatestOnly
windowed_duration_ms: u64Total sync duration (in milliseconds) for WindowedHistory
Implementations§
Source§impl SyncModeMetrics
impl SyncModeMetrics
Sourcepub fn record_sync(
&mut self,
_collection: &str,
mode: SyncMode,
bytes: u64,
duration: Duration,
)
pub fn record_sync( &mut self, _collection: &str, mode: SyncMode, bytes: u64, duration: Duration, )
Record a sync operation
Sourcepub fn avg_full_history_bytes(&self) -> f64
pub fn avg_full_history_bytes(&self) -> f64
Average bytes per sync for FullHistory mode
Sourcepub fn avg_latest_only_bytes(&self) -> f64
pub fn avg_latest_only_bytes(&self) -> f64
Average bytes per sync for LatestOnly mode
Sourcepub fn bandwidth_savings_ratio(&self) -> Option<f64>
pub fn bandwidth_savings_ratio(&self) -> Option<f64>
Bandwidth savings ratio (LatestOnly vs FullHistory)
Returns the ratio of FullHistory bytes to LatestOnly bytes. A ratio of 300.0 means LatestOnly uses 300× less bandwidth.
Trait Implementations§
Source§impl Clone for SyncModeMetrics
impl Clone for SyncModeMetrics
Source§fn clone(&self) -> SyncModeMetrics
fn clone(&self) -> SyncModeMetrics
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more