pub struct AlertManager { /* private fields */ }Expand description
Alert manager for tracking and deduplicating alerts
Implementations§
Source§impl AlertManager
impl AlertManager
Sourcepub fn new(max_history: usize, dedup_window_seconds: i64) -> Self
pub fn new(max_history: usize, dedup_window_seconds: i64) -> Self
Create a new alert manager
§Arguments
max_history- Maximum number of alerts to keep in historydedup_window_seconds- Time window for deduplicating alerts (e.g., 300 = 5 minutes)
Sourcepub fn add_callback(&mut self, callback: AlertCallback)
pub fn add_callback(&mut self, callback: AlertCallback)
Add an alert callback
Sourcepub fn record_alert(&mut self, alert: Alert) -> bool
pub fn record_alert(&mut self, alert: Alert) -> bool
Sourcepub fn get_alerts(&self) -> &[Alert]
pub fn get_alerts(&self) -> &[Alert]
Get all alerts
Sourcepub fn get_critical_alerts(&self) -> Vec<&Alert>
pub fn get_critical_alerts(&self) -> Vec<&Alert>
Get critical alerts
Sourcepub fn get_warning_alerts(&self) -> Vec<&Alert>
pub fn get_warning_alerts(&self) -> Vec<&Alert>
Get warning alerts
Sourcepub fn get_task_alerts(&self, task_name: &str) -> Vec<&Alert>
pub fn get_task_alerts(&self, task_name: &str) -> Vec<&Alert>
Get alerts for a specific task
Sourcepub fn get_recent_alerts(&self, seconds: i64) -> Vec<&Alert>
pub fn get_recent_alerts(&self, seconds: i64) -> Vec<&Alert>
Get recent alerts (within specified seconds)
Sourcepub fn clear_task_alerts(&mut self, task_name: &str)
pub fn clear_task_alerts(&mut self, task_name: &str)
Clear alerts for a specific task
Sourcepub fn alert_count(&self) -> usize
pub fn alert_count(&self) -> usize
Get alert count
Sourcepub fn critical_alert_count(&self) -> usize
pub fn critical_alert_count(&self) -> usize
Get critical alert count
Sourcepub fn warning_alert_count(&self) -> usize
pub fn warning_alert_count(&self) -> usize
Get warning alert count
Trait Implementations§
Source§impl Clone for AlertManager
impl Clone for AlertManager
Source§impl Debug for AlertManager
impl Debug for AlertManager
Source§impl Default for AlertManager
impl Default for AlertManager
Source§impl<'de> Deserialize<'de> for AlertManager
impl<'de> Deserialize<'de> for AlertManager
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 !RefUnwindSafe for AlertManager
impl !UnwindSafe for AlertManager
impl Freeze for AlertManager
impl Send for AlertManager
impl Sync for AlertManager
impl Unpin for AlertManager
impl UnsafeUnpin for AlertManager
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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