pub struct AlertRule {Show 14 fields
pub id: Uuid,
pub name: String,
pub description: Option<String>,
pub metric_name: String,
pub condition: AlertCondition,
pub threshold: f64,
pub duration_seconds: i32,
pub severity: AlertSeverity,
pub enabled: bool,
pub labels: HashMap<String, String>,
pub notification_channels: Vec<String>,
pub cooldown_seconds: i32,
pub created_at: DateTime<Utc>,
pub updated_at: DateTime<Utc>,
}Expand description
Alert rule definition.
Fields§
§id: Uuid§name: String§description: Option<String>§metric_name: String§condition: AlertCondition§threshold: f64§duration_seconds: i32§severity: AlertSeverity§enabled: bool§labels: HashMap<String, String>§notification_channels: Vec<String>§cooldown_seconds: i32§created_at: DateTime<Utc>§updated_at: DateTime<Utc>Implementations§
Source§impl AlertRule
impl AlertRule
Sourcepub fn new(
name: impl Into<String>,
metric_name: impl Into<String>,
condition: AlertCondition,
threshold: f64,
) -> Self
pub fn new( name: impl Into<String>, metric_name: impl Into<String>, condition: AlertCondition, threshold: f64, ) -> Self
Create a new alert rule.
Sourcepub fn with_description(self, description: impl Into<String>) -> Self
pub fn with_description(self, description: impl Into<String>) -> Self
Set description.
Sourcepub fn with_severity(self, severity: AlertSeverity) -> Self
pub fn with_severity(self, severity: AlertSeverity) -> Self
Set severity.
Sourcepub fn with_duration(self, seconds: i32) -> Self
pub fn with_duration(self, seconds: i32) -> Self
Set duration (seconds that condition must be true).
Trait Implementations§
Source§impl<'de> Deserialize<'de> for AlertRule
impl<'de> Deserialize<'de> for AlertRule
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 AlertRule
impl RefUnwindSafe for AlertRule
impl Send for AlertRule
impl Sync for AlertRule
impl Unpin for AlertRule
impl UnwindSafe for AlertRule
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