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 new() -> SyncModeMetrics
pub fn new() -> SyncModeMetrics
Create new empty metrics
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 moreSource§impl Debug for SyncModeMetrics
impl Debug for SyncModeMetrics
Source§impl Default for SyncModeMetrics
impl Default for SyncModeMetrics
Source§fn default() -> SyncModeMetrics
fn default() -> SyncModeMetrics
Auto Trait Implementations§
impl Freeze for SyncModeMetrics
impl RefUnwindSafe for SyncModeMetrics
impl Send for SyncModeMetrics
impl Sync for SyncModeMetrics
impl Unpin for SyncModeMetrics
impl UnsafeUnpin for SyncModeMetrics
impl UnwindSafe for SyncModeMetrics
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more