pub struct RollingWindow { /* private fields */ }Expand description
Fixed-bucket sliding window for resilience decisions.
Implementations§
Source§impl RollingWindow
impl RollingWindow
Sourcepub fn new(config: WindowConfig) -> Self
pub fn new(config: WindowConfig) -> Self
Creates a rolling window from configuration.
Sourcepub fn record(&mut self, outcome: WindowOutcome)
pub fn record(&mut self, outcome: WindowOutcome)
Records an outcome at the current instant.
Sourcepub fn record_with_latency(&mut self, outcome: WindowOutcome, latency: Duration)
pub fn record_with_latency(&mut self, outcome: WindowOutcome, latency: Duration)
Records an outcome with a latency sample at the current instant.
Sourcepub fn snapshot(&self) -> WindowSnapshot
pub fn snapshot(&self) -> WindowSnapshot
Returns an aggregate over all live buckets.
Sourcepub fn max_successes_per_bucket(&self) -> u64
pub fn max_successes_per_bucket(&self) -> u64
Returns the maximum successful operations observed in one live bucket.
Sourcepub fn min_average_latency(&self) -> Option<Duration>
pub fn min_average_latency(&self) -> Option<Duration>
Returns the minimum average latency observed in one live bucket.
Trait Implementations§
Source§impl Clone for RollingWindow
impl Clone for RollingWindow
Source§fn clone(&self) -> RollingWindow
fn clone(&self) -> RollingWindow
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for RollingWindow
impl RefUnwindSafe for RollingWindow
impl Send for RollingWindow
impl Sync for RollingWindow
impl Unpin for RollingWindow
impl UnsafeUnpin for RollingWindow
impl UnwindSafe for RollingWindow
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,
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request