pub struct PeerMetrics {
pub node_id: String,
pub rtt_ms: f64,
pub messages_sent: u64,
pub messages_received: u64,
pub bytes_sent: u64,
pub bytes_received: u64,
pub errors: u64,
pub last_updated: u64,
}Expand description
Observability metrics for a mesh peer, used for affinity scoring.
Fields§
§node_id: StringNode identifier.
rtt_ms: f64Smoothed round-trip time in milliseconds.
messages_sent: u64Total messages sent to this peer.
messages_received: u64Total messages received from this peer.
bytes_sent: u64Total bytes sent to this peer.
bytes_received: u64Total bytes received from this peer.
errors: u64Total errors encountered with this peer.
last_updated: u64Last update timestamp (epoch millis).
Implementations§
Source§impl PeerMetrics
impl PeerMetrics
Sourcepub fn affinity_score(&self) -> f64
pub fn affinity_score(&self) -> f64
Affinity score (lower is better). Used for service resolution preference.
Sourcepub fn record_send(&mut self, bytes: u64)
pub fn record_send(&mut self, bytes: u64)
Record a successful message send.
Sourcepub fn record_recv(&mut self, bytes: u64)
pub fn record_recv(&mut self, bytes: u64)
Record a received message.
Sourcepub fn record_error(&mut self)
pub fn record_error(&mut self)
Record an error.
Sourcepub fn update_rtt(&mut self, rtt_ms: f64)
pub fn update_rtt(&mut self, rtt_ms: f64)
Update RTT measurement using exponential moving average.
Trait Implementations§
Source§impl Clone for PeerMetrics
impl Clone for PeerMetrics
Source§impl Debug for PeerMetrics
impl Debug for PeerMetrics
Source§impl<'de> Deserialize<'de> for PeerMetrics
impl<'de> Deserialize<'de> for PeerMetrics
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for PeerMetrics
impl RefUnwindSafe for PeerMetrics
impl Send for PeerMetrics
impl Sync for PeerMetrics
impl Unpin for PeerMetrics
impl UnsafeUnpin for PeerMetrics
impl UnwindSafe for PeerMetrics
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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> ⓘ
Converts
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> ⓘ
Converts
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