pub struct StreamingAnomalyEngine { /* private fields */ }Expand description
Real-time streaming anomaly detection engine.
Processes CDC write events and runs per-series anomaly detection,
emitting AnomalyScore results.
Implementations§
Source§impl StreamingAnomalyEngine
impl StreamingAnomalyEngine
Sourcepub fn enable(&self, config: StreamingAnomalyConfig) -> Result<()>
pub fn enable(&self, config: StreamingAnomalyConfig) -> Result<()>
Enable streaming anomaly detection for a measurement.
Sourcepub fn disable(&self, measurement: &str)
pub fn disable(&self, measurement: &str)
Disable streaming anomaly detection for a measurement.
Sourcepub fn is_enabled(&self, measurement: &str) -> bool
pub fn is_enabled(&self, measurement: &str) -> bool
Check if a measurement has streaming anomaly detection enabled.
Sourcepub fn process_write(
&self,
measurement: &str,
tags: &BTreeMap<String, String>,
fields: &BTreeMap<String, FieldValue>,
timestamp: i64,
) -> Option<ScoredAnomaly>
pub fn process_write( &self, measurement: &str, tags: &BTreeMap<String, String>, fields: &BTreeMap<String, FieldValue>, timestamp: i64, ) -> Option<ScoredAnomaly>
Process a CDC write event.
Returns the anomaly score if detection was performed (i.e., the series has enough data and is configured).
Sourcepub fn scores(&self) -> Vec<ScoredAnomaly>
pub fn scores(&self) -> Vec<ScoredAnomaly>
Get all scored anomalies.
Sourcepub fn scores_for_measurement(&self, measurement: &str) -> Vec<ScoredAnomaly>
pub fn scores_for_measurement(&self, measurement: &str) -> Vec<ScoredAnomaly>
Get anomaly scores for a measurement.
Sourcepub fn anomalies(&self) -> Vec<ScoredAnomaly>
pub fn anomalies(&self) -> Vec<ScoredAnomaly>
Get only anomalous scores.
Sourcepub fn config_count(&self) -> usize
pub fn config_count(&self) -> usize
Number of configured measurements.
Sourcepub fn series_count(&self) -> usize
pub fn series_count(&self) -> usize
Number of tracked series.
Sourcepub fn drain_scores(&self) -> Vec<ScoredAnomaly>
pub fn drain_scores(&self) -> Vec<ScoredAnomaly>
Drain all scores.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for StreamingAnomalyEngine
impl !RefUnwindSafe for StreamingAnomalyEngine
impl !UnwindSafe for StreamingAnomalyEngine
impl Send for StreamingAnomalyEngine
impl Sync for StreamingAnomalyEngine
impl Unpin for StreamingAnomalyEngine
impl UnsafeUnpin for StreamingAnomalyEngine
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