pub struct Alert {
pub timestamp: DateTime<Utc>,
pub task_name: String,
pub level: AlertLevel,
pub condition: AlertCondition,
pub message: String,
pub metadata: HashMap<String, String>,
}Expand description
Alert record
Fields§
§timestamp: DateTime<Utc>Alert timestamp
task_name: StringTask name that triggered the alert
level: AlertLevelAlert severity level
condition: AlertConditionCondition that triggered the alert
message: StringHuman-readable message
metadata: HashMap<String, String>Additional metadata (optional)
Implementations§
Source§impl Alert
impl Alert
Sourcepub fn new(
task_name: String,
level: AlertLevel,
condition: AlertCondition,
message: String,
) -> Self
pub fn new( task_name: String, level: AlertLevel, condition: AlertCondition, message: String, ) -> Self
Create a new alert
Sourcepub fn with_metadata(self, key: String, value: String) -> Self
pub fn with_metadata(self, key: String, value: String) -> Self
Add metadata to the alert
Sourcepub fn is_critical(&self) -> bool
pub fn is_critical(&self) -> bool
Check if this is a critical alert
Sourcepub fn is_warning(&self) -> bool
pub fn is_warning(&self) -> bool
Check if this is a warning alert
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Alert
impl<'de> Deserialize<'de> for Alert
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 Alert
impl RefUnwindSafe for Alert
impl Send for Alert
impl Sync for Alert
impl Unpin for Alert
impl UnsafeUnpin for Alert
impl UnwindSafe for Alert
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