pub struct AlertRule {
pub id: String,
pub name: String,
pub description: String,
pub metric_name: String,
pub condition: AlertCondition,
pub severity: AlertSeverity,
pub enabled: bool,
pub cooldown_seconds: u64,
}Expand description
Alert rule definition
Fields§
§id: StringUnique identifier for the rule
name: StringHuman-readable name for the rule
description: StringDescription of what this rule monitors
metric_name: StringMetric name to monitor
condition: AlertConditionCondition that triggers the alert
severity: AlertSeveritySeverity level of the alert
enabled: boolWhether the rule is enabled
cooldown_seconds: u64Cooldown period between alerts (in seconds)
Implementations§
Source§impl AlertRule
impl AlertRule
Sourcepub fn new(
id: String,
name: String,
metric_name: String,
condition: AlertCondition,
severity: AlertSeverity,
) -> Self
pub fn new( id: String, name: String, metric_name: String, condition: AlertCondition, severity: AlertSeverity, ) -> Self
Create a new alert rule
Sourcepub fn with_description(self, description: String) -> Self
pub fn with_description(self, description: String) -> Self
Set the description
Sourcepub fn with_cooldown(self, cooldown_seconds: u64) -> Self
pub fn with_cooldown(self, cooldown_seconds: u64) -> Self
Set the cooldown period
Sourcepub fn set_enabled(self, enabled: bool) -> Self
pub fn set_enabled(self, enabled: bool) -> Self
Enable or disable the rule
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