pub struct HealthHistory { /* private fields */ }Expand description
Sliding-window health history for trend analysis.
Implementations§
Source§impl HealthHistory
impl HealthHistory
Sourcepub fn new(max_records: usize, window: Duration) -> Self
pub fn new(max_records: usize, window: Duration) -> Self
Create a new health history with a sliding window.
Sourcepub fn record(&mut self, status: HealthStatus)
pub fn record(&mut self, status: HealthStatus)
Record a health check result.
Sourcepub fn success_rate(&self) -> f64
pub fn success_rate(&self) -> f64
Calculate the success rate within the sliding window (0.0 to 1.0).
Sourcepub fn assess(&self, degradation_threshold: f64) -> HealthStatus
pub fn assess(&self, degradation_threshold: f64) -> HealthStatus
Determine if the provider is degraded based on success rate threshold.
Returns Degraded if success rate is below the threshold but not zero,
Unhealthy if success rate is zero, Healthy otherwise.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for HealthHistory
impl RefUnwindSafe for HealthHistory
impl Send for HealthHistory
impl Sync for HealthHistory
impl Unpin for HealthHistory
impl UnsafeUnpin for HealthHistory
impl UnwindSafe for HealthHistory
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