pub struct AlertEngine { /* private fields */ }Expand description
Alert engine — evaluates anomaly scores against configured alerts.
Implementations§
Source§impl AlertEngine
impl AlertEngine
Sourcepub fn register(&self, config: AlertConfig)
pub fn register(&self, config: AlertConfig)
Register an alert configuration.
Sourcepub fn unregister(&self, id: &str)
pub fn unregister(&self, id: &str)
Unregister an alert.
Sourcepub fn evaluate(
&self,
measurement: &str,
tags: &BTreeMap<String, String>,
score: f64,
timestamp: i64,
) -> Vec<FiredAlert>
pub fn evaluate( &self, measurement: &str, tags: &BTreeMap<String, String>, score: f64, timestamp: i64, ) -> Vec<FiredAlert>
Evaluate an anomaly score against all configured alerts for a measurement.
Returns the fired alert records (if any).
Sourcepub fn history(&self) -> Vec<FiredAlert>
pub fn history(&self) -> Vec<FiredAlert>
Get alert firing history.
Sourcepub fn alert_count(&self) -> usize
pub fn alert_count(&self) -> usize
Number of configured alerts.
Sourcepub fn evict_stale_cooldowns(&self)
pub fn evict_stale_cooldowns(&self)
Evict expired cooldown entries to prevent unbounded growth.
Removes entries whose cooldown period has elapsed according to the alert config. Entries for unregistered alerts are always removed.
Sourcepub fn cooldown_count(&self) -> usize
pub fn cooldown_count(&self) -> usize
Number of active cooldown entries (for diagnostics).
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for AlertEngine
impl !RefUnwindSafe for AlertEngine
impl Send for AlertEngine
impl Sync for AlertEngine
impl Unpin for AlertEngine
impl UnsafeUnpin for AlertEngine
impl UnwindSafe for AlertEngine
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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