pub struct AlertManager {
pub active_alerts: HashMap<String, Alert>,
pub alert_history: VecDeque<Alert>,
pub notification_channels: Vec<NotificationChannel>,
pub alert_rules: Vec<AlertRule>,
/* private fields */
}
Expand description
Alert management system
Fields§
§active_alerts: HashMap<String, Alert>
§alert_history: VecDeque<Alert>
§notification_channels: Vec<NotificationChannel>
§alert_rules: Vec<AlertRule>
Implementations§
Source§impl AlertManager
impl AlertManager
Sourcepub fn remove_rule(&mut self, rule_id: &str)
pub fn remove_rule(&mut self, rule_id: &str)
Remove an alert rule
Sourcepub fn set_rule_enabled(&mut self, rule_id: &str, enabled: bool)
pub fn set_rule_enabled(&mut self, rule_id: &str, enabled: bool)
Enable/disable a rule
Sourcepub fn process_sample(
&mut self,
sample: &PerformanceSample,
baseline: Option<f64>,
)
pub fn process_sample( &mut self, sample: &PerformanceSample, baseline: Option<f64>, )
Process a performance sample for alert evaluation
Sourcepub fn resolve_alert(&mut self, alert_id: &str) -> bool
pub fn resolve_alert(&mut self, alert_id: &str) -> bool
Manually resolve an alert
Sourcepub fn get_active_alerts(&self) -> Vec<&Alert>
pub fn get_active_alerts(&self) -> Vec<&Alert>
Get active alerts
Sourcepub fn get_alerts_by_severity(&self, severity: AlertSeverity) -> Vec<&Alert>
pub fn get_alerts_by_severity(&self, severity: AlertSeverity) -> Vec<&Alert>
Get alerts by severity
Sourcepub fn get_alert_stats(&self) -> AlertStats
pub fn get_alert_stats(&self) -> AlertStats
Get alert statistics
Sourcepub fn create_default_alert_rules() -> Vec<AlertRule>
pub fn create_default_alert_rules() -> Vec<AlertRule>
Create default alert rules
Sourcepub fn clear_all_alerts(&mut self)
pub fn clear_all_alerts(&mut self)
Clear all alerts
Sourcepub fn add_notification_channel(&mut self, channel: NotificationChannel)
pub fn add_notification_channel(&mut self, channel: NotificationChannel)
Add notification channel
Trait Implementations§
Auto Trait Implementations§
impl Freeze for AlertManager
impl RefUnwindSafe for AlertManager
impl Send for AlertManager
impl Sync for AlertManager
impl Unpin for AlertManager
impl UnwindSafe for AlertManager
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> 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