pub struct HostTelemetry {
pub max_samples: usize,
pub ttl: Option<u8>,
pub distance_hops: Option<u8>,
/* private fields */
}Expand description
Performance and discovery metrics for a specific network host.
HostTelemetry maintains a sliding window of Round-Trip Time (RTT)
measurements and performs statistical analysis (Averaging and Jitter)
used for network health assessment.
Fields§
§max_samples: usizeThe maximum number of RTT samples to maintain. If this limit is reached, adding a new sample will purge the oldest one.
ttl: Option<u8>The Time-to-Live (TTL) value from the most recently received response.
distance_hops: Option<u8>The calculated network distance in hops, derived from TTL or traceroute probes.
Implementations§
Source§impl HostTelemetry
impl HostTelemetry
Sourcepub fn new(max_samples: usize) -> Self
pub fn new(max_samples: usize) -> Self
Creates a new HostTelemetry instance with a specific sample window size.
Sourcepub fn history(&self) -> &VecDeque<(Instant, Duration)>
pub fn history(&self) -> &VecDeque<(Instant, Duration)>
Returns a read-only view of the RTT sample history.
Sourcepub fn add_rtt(&mut self, rtt: Duration)
pub fn add_rtt(&mut self, rtt: Duration)
Adds a new RTT measurement at the current system time.
Sourcepub fn add_rtt_at(&mut self, time: Instant, rtt: Duration)
pub fn add_rtt_at(&mut self, time: Instant, rtt: Duration)
Adds a timed RTT measurement to the history, enforcing the sliding window cap.
Sourcepub fn min_rtt(&self) -> Option<Duration>
pub fn min_rtt(&self) -> Option<Duration>
Returns the minimum (fastest) RTT recorded in the current window.
Sourcepub fn max_rtt(&self) -> Option<Duration>
pub fn max_rtt(&self) -> Option<Duration>
Returns the maximum (slowest) RTT recorded in the current window.
Sourcepub fn average_rtt(&self) -> Option<Duration>
pub fn average_rtt(&self) -> Option<Duration>
Calculates the arithmetic mean RTT from all samples in the window.
Sourcepub fn jitter(&self) -> Option<Duration>
pub fn jitter(&self) -> Option<Duration>
Calculates the network jitter as the Average Absolute Difference between consecutive RTT samples.
Jitter provides a measure of network stability. A high jitter relative to the average RTT often indicates network congestion or bufferbloat.
Sourcepub fn merge(&mut self, other: HostTelemetry)
pub fn merge(&mut self, other: HostTelemetry)
Merges telemetry from another record, Ensuring chronological sortedness and prioritizing the newest data points.
If the incoming record has a larger max_samples configuration, this
telemetry container will upgrade its own window size to match.
Trait Implementations§
Source§impl Clone for HostTelemetry
impl Clone for HostTelemetry
Source§fn clone(&self) -> HostTelemetry
fn clone(&self) -> HostTelemetry
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for HostTelemetry
impl Debug for HostTelemetry
Source§impl Default for HostTelemetry
impl Default for HostTelemetry
Source§impl Display for HostTelemetry
impl Display for HostTelemetry
impl Eq for HostTelemetry
Source§impl PartialEq for HostTelemetry
impl PartialEq for HostTelemetry
impl StructuralPartialEq for HostTelemetry
Auto Trait Implementations§
impl Freeze for HostTelemetry
impl RefUnwindSafe for HostTelemetry
impl Send for HostTelemetry
impl Sync for HostTelemetry
impl Unpin for HostTelemetry
impl UnsafeUnpin for HostTelemetry
impl UnwindSafe for HostTelemetry
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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