pub struct AlertConfig {
pub id: String,
pub measurement: String,
pub threshold: f64,
pub cooldown: Duration,
pub actions: Vec<AlertAction>,
pub enabled: bool,
}Expand description
Configuration for an alert.
Fields§
§id: StringUnique alert ID.
measurement: StringMeasurement this alert applies to.
threshold: f64Anomaly score threshold to fire the alert.
cooldown: DurationCooldown period between firings for the same series.
actions: Vec<AlertAction>Actions to take when the alert fires.
enabled: boolWhether the alert is enabled.
Implementations§
Source§impl AlertConfig
impl AlertConfig
Sourcepub fn new(
id: impl Into<String>,
measurement: impl Into<String>,
threshold: f64,
) -> Self
pub fn new( id: impl Into<String>, measurement: impl Into<String>, threshold: f64, ) -> Self
Create a new alert config.
Sourcepub fn with_cooldown(self, cooldown: Duration) -> Self
pub fn with_cooldown(self, cooldown: Duration) -> Self
Set the cooldown period.
Sourcepub fn with_actions(self, actions: Vec<AlertAction>) -> Self
pub fn with_actions(self, actions: Vec<AlertAction>) -> Self
Set the alert actions.
Sourcepub fn with_action(self, action: AlertAction) -> Self
pub fn with_action(self, action: AlertAction) -> Self
Add an action.
Trait Implementations§
Source§impl Clone for AlertConfig
impl Clone for AlertConfig
Source§fn clone(&self) -> AlertConfig
fn clone(&self) -> AlertConfig
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 AlertConfig
impl RefUnwindSafe for AlertConfig
impl Send for AlertConfig
impl Sync for AlertConfig
impl Unpin for AlertConfig
impl UnsafeUnpin for AlertConfig
impl UnwindSafe for AlertConfig
Blanket Implementations§
impl<T> Allocation for T
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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