pub struct PeerLoad {
pub peer_id: String,
pub active_connections: u32,
pub weight: u32,
pub avg_latency_ms: f64,
pub total_requests: u64,
pub failed_requests: u64,
}Expand description
Per-peer load tracking information.
Fields§
§peer_id: StringUnique peer identifier.
active_connections: u32Number of currently in-flight requests.
weight: u32Routing weight; higher values attract more requests.
avg_latency_ms: f64Exponentially-weighted moving average of latency (ms), alpha = 0.2.
total_requests: u64Total requests ever dispatched to this peer.
failed_requests: u64Total failed requests for this peer.
Implementations§
Source§impl PeerLoad
impl PeerLoad
Sourcepub fn failure_rate(&self) -> f64
pub fn failure_rate(&self) -> f64
Fraction of requests that have failed; returns 0.0 when no requests
have been dispatched yet.
Sourcepub fn is_healthy(&self) -> bool
pub fn is_healthy(&self) -> bool
A peer is healthy when its failure rate is below 50 % and it has fewer than 1 000 active connections.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PeerLoad
impl RefUnwindSafe for PeerLoad
impl Send for PeerLoad
impl Sync for PeerLoad
impl Unpin for PeerLoad
impl UnsafeUnpin for PeerLoad
impl UnwindSafe for PeerLoad
Blanket Implementations§
impl<T> Allocation for T
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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>
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