pub struct OutlierDetector { /* private fields */ }Expand description
Shared state tracking ejection status across all backends.
Each backend registers with the detector and reports errors.
The detector enforces max_ejection_percent globally.
Implementations§
Source§impl OutlierDetector
impl OutlierDetector
Sourcepub fn new(max_ejection_percent: u32) -> Self
pub fn new(max_ejection_percent: u32) -> Self
Create a new outlier detector.
max_ejection_percent caps how many backends can be ejected at once
(as a percentage of total registered backends).
Sourcepub fn register_backend(&self)
pub fn register_backend(&self)
Register a backend. Call once per backend at startup.
Sourcepub fn try_eject(&self) -> bool
pub fn try_eject(&self) -> bool
Try to eject a backend. Returns true if ejection is allowed.
Respects max_ejection_percent – if ejecting this backend would
exceed the threshold, returns false.
Sourcepub fn record_uneject(&self)
pub fn record_uneject(&self)
Record that a backend has been un-ejected.
Sourcepub fn ejected_count(&self) -> u32
pub fn ejected_count(&self) -> u32
Current number of ejected backends (for observability).
Sourcepub fn total_backends(&self) -> u32
pub fn total_backends(&self) -> u32
Total registered backends.
Trait Implementations§
Source§impl Clone for OutlierDetector
impl Clone for OutlierDetector
Source§fn clone(&self) -> OutlierDetector
fn clone(&self) -> OutlierDetector
Returns a duplicate of the value. Read more
1.0.0 · 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 OutlierDetector
impl RefUnwindSafe for OutlierDetector
impl Send for OutlierDetector
impl Sync for OutlierDetector
impl Unpin for OutlierDetector
impl UnsafeUnpin for OutlierDetector
impl UnwindSafe for OutlierDetector
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 more