pub struct Alert {
pub id: Uuid,
pub severity: AlertSeverity,
pub title: String,
pub message: String,
pub data: HashMap<String, Value>,
pub tags: Vec<String>,
pub timestamp: DateTime<Utc>,
pub source: Option<String>,
}Expand description
An alert to be sent through the pipeline
Fields§
§id: UuidUnique identifier for this alert
severity: AlertSeverityAlert severity level
title: StringAlert title/subject (brief description)
message: StringDetailed message
data: HashMap<String, Value>Structured data associated with the alert
Tags for routing (e.g., [“price”, “btc”, “urgent”])
timestamp: DateTime<Utc>Timestamp when the alert was created
source: Option<String>Source of the alert (e.g., script name, strategy name)
Implementations§
Source§impl Alert
impl Alert
Sourcepub fn new(title: impl Into<String>, message: impl Into<String>) -> Self
pub fn new(title: impl Into<String>, message: impl Into<String>) -> Self
Create a new alert with the given title and message
Sourcepub fn with_severity(self, severity: AlertSeverity) -> Self
pub fn with_severity(self, severity: AlertSeverity) -> Self
Set the severity level
Add multiple tags
Sourcepub fn with_source(self, source: impl Into<String>) -> Self
pub fn with_source(self, source: impl Into<String>) -> Self
Set the source
Sourcepub fn has_any_tag(&self, tags: &[String]) -> bool
pub fn has_any_tag(&self, tags: &[String]) -> bool
Check if alert has any of the specified tags
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<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