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,
/* private fields */
}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).
Implementations§
Source§impl AlertTrigger
impl AlertTrigger
Sourcepub fn new(
name: impl Into<String>,
metric: impl Into<String>,
operator: ThresholdOperator,
threshold: f64,
severity: AlertSeverity,
) -> Self
pub fn new( name: impl Into<String>, metric: impl Into<String>, operator: ThresholdOperator, threshold: f64, severity: AlertSeverity, ) -> Self
Create a new alert trigger.
Sourcepub fn with_hold_duration(self, duration: Duration) -> Self
pub fn with_hold_duration(self, duration: Duration) -> Self
Set the hold duration (condition must persist this long before triggering).
Sourcepub fn with_cooldown(self, duration: Duration) -> Self
pub fn with_cooldown(self, duration: Duration) -> Self
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 UnsafeUnpin for AlertTrigger
impl UnwindSafe for AlertTrigger
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
Source§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
Source§impl<F, W, T, D> Deserialize<With<T, W>, D> for F
impl<F, W, T, D> Deserialize<With<T, W>, D> for F
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> LayoutRaw for T
impl<T> LayoutRaw for T
Source§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.