pub struct AlertState {
pub status: AlertStatus,
pub pending_since: Option<DateTime<Utc>>,
pub firing_since: Option<DateTime<Utc>>,
pub resolved_at: Option<DateTime<Utc>>,
pub last_evaluation: Option<DateTime<Utc>>,
pub last_value: Option<f64>,
}Expand description
Alert state tracking.
Fields§
§status: AlertStatusCurrent status.
pending_since: Option<DateTime<Utc>>When the condition first became true.
firing_since: Option<DateTime<Utc>>When the alert started firing.
resolved_at: Option<DateTime<Utc>>When the alert was last resolved.
last_evaluation: Option<DateTime<Utc>>Last evaluation time.
last_value: Option<f64>Last evaluation result.
Implementations§
Source§impl AlertState
impl AlertState
Sourcepub fn set_pending(&mut self)
pub fn set_pending(&mut self)
Transition to pending state.
Sourcepub fn set_firing(&mut self)
pub fn set_firing(&mut self)
Transition to firing state.
Sourcepub fn set_resolved(&mut self)
pub fn set_resolved(&mut self)
Transition to resolved state.
Sourcepub fn set_inactive(&mut self)
pub fn set_inactive(&mut self)
Transition to inactive state.
Sourcepub fn update_evaluation(&mut self, value: f64)
pub fn update_evaluation(&mut self, value: f64)
Update after evaluation.
Sourcepub fn should_fire(&self, for_duration: Duration) -> bool
pub fn should_fire(&self, for_duration: Duration) -> bool
Check if the alert should transition from pending to firing.
Trait Implementations§
Source§impl Clone for AlertState
impl Clone for AlertState
Source§fn clone(&self) -> AlertState
fn clone(&self) -> AlertState
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 moreSource§impl Debug for AlertState
impl Debug for AlertState
Source§impl Default for AlertState
impl Default for AlertState
Source§impl<'de> Deserialize<'de> for AlertState
impl<'de> Deserialize<'de> for AlertState
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 AlertState
impl RefUnwindSafe for AlertState
impl Send for AlertState
impl Sync for AlertState
impl Unpin for AlertState
impl UnwindSafe for AlertState
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