Struct AlertTrigger
pub struct AlertTrigger {
pub name: String,
pub metric: String,
pub threshold: f64,
pub operator: ThresholdOperator,
pub severity: AlertSeverity,
pub hold_duration: Duration,
pub cooldown: Duration,
last_triggered: Option<Instant>,
condition_start: Option<Instant>,
}Expand description
A threshold-based alert trigger that fires when a metric crosses a threshold.
Fields§
§name: StringTrigger name.
metric: StringMetric name to watch.
threshold: f64Threshold value.
operator: ThresholdOperatorComparison operator.
severity: AlertSeveritySeverity when triggered.
hold_duration: DurationMinimum duration the condition must hold before triggering.
cooldown: DurationCooldown after firing (suppress repeated alerts).
last_triggered: Option<Instant>§condition_start: Option<Instant>Implementations§
§impl AlertTrigger
impl AlertTrigger
pub fn new(
name: impl Into<String>,
metric: impl Into<String>,
operator: ThresholdOperator,
threshold: f64,
severity: AlertSeverity,
) -> AlertTrigger
pub fn new( name: impl Into<String>, metric: impl Into<String>, operator: ThresholdOperator, threshold: f64, severity: AlertSeverity, ) -> AlertTrigger
Create a new alert trigger.
pub fn with_hold_duration(self, duration: Duration) -> AlertTrigger
pub fn with_hold_duration(self, duration: Duration) -> AlertTrigger
Set the hold duration (condition must persist this long before triggering).
pub fn with_cooldown(self, duration: Duration) -> AlertTrigger
pub fn with_cooldown(self, duration: Duration) -> AlertTrigger
Set the cooldown period after triggering.
Auto Trait Implementations§
impl Freeze for AlertTrigger
impl RefUnwindSafe for AlertTrigger
impl Send for AlertTrigger
impl Sync for AlertTrigger
impl Unpin for AlertTrigger
impl UnwindSafe for AlertTrigger
Blanket Implementations§
§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
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<F, W, T, D> Deserialize<With<T, W>, D> for F
impl<F, W, T, D> Deserialize<With<T, W>, D> for F
§fn deserialize(
&self,
deserializer: &mut D,
) -> Result<With<T, W>, <D as Fallible>::Error>
fn deserialize( &self, deserializer: &mut D, ) -> Result<With<T, W>, <D as Fallible>::Error>
Deserializes using the given deserializer
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Gets the layout of the type.