pub struct AnomalyDetector { /* private fields */ }Expand description
Anomaly detector
Implementations§
Source§impl AnomalyDetector
impl AnomalyDetector
Sourcepub fn new(config: AnomalyDetectorConfig) -> Self
pub fn new(config: AnomalyDetectorConfig) -> Self
Create a new anomaly detector
Sourcepub fn add_data_point(&mut self, metric_name: String, point: TimeSeriesPoint)
pub fn add_data_point(&mut self, metric_name: String, point: TimeSeriesPoint)
Add time-series data point
Sourcepub fn update_baseline(
&mut self,
metric_name: &str,
) -> Result<MetricBaseline, String>
pub fn update_baseline( &mut self, metric_name: &str, ) -> Result<MetricBaseline, String>
Update baseline for a metric
Sourcepub fn detect_value_anomaly(
&self,
metric_name: &str,
value: f64,
context: HashMap<String, String>,
) -> Option<Anomaly>
pub fn detect_value_anomaly( &self, metric_name: &str, value: f64, context: HashMap<String, String>, ) -> Option<Anomaly>
Detect anomalies in a single value
Sourcepub fn detect_timeseries_anomalies(
&self,
metric_name: &str,
lookback_hours: i64,
) -> Result<Vec<Anomaly>, String>
pub fn detect_timeseries_anomalies( &self, metric_name: &str, lookback_hours: i64, ) -> Result<Vec<Anomaly>, String>
Detect anomalies in time series using multiple methods
Sourcepub fn detect_collective_anomalies(
&self,
metric_names: &[String],
lookback_hours: i64,
) -> Result<Vec<Anomaly>, String>
pub fn detect_collective_anomalies( &self, metric_names: &[String], lookback_hours: i64, ) -> Result<Vec<Anomaly>, String>
Detect collective anomalies (patterns across multiple metrics)
Sourcepub fn get_baseline(&self, metric_name: &str) -> Option<&MetricBaseline>
pub fn get_baseline(&self, metric_name: &str) -> Option<&MetricBaseline>
Get baseline for a metric
Sourcepub fn get_all_baselines(&self) -> Vec<MetricBaseline>
pub fn get_all_baselines(&self) -> Vec<MetricBaseline>
Get all baselines
Sourcepub fn clear_data(&mut self)
pub fn clear_data(&mut self)
Clear all data
Auto Trait Implementations§
impl Freeze for AnomalyDetector
impl RefUnwindSafe for AnomalyDetector
impl Send for AnomalyDetector
impl Sync for AnomalyDetector
impl Unpin for AnomalyDetector
impl UnwindSafe for AnomalyDetector
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> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request