pub trait FieldAnomalyDetector: Send + Sync {
// Required methods
fn name(&self) -> &'static str;
fn observe<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
schema_id: &'life1 SchemaId,
field: &'life2 FieldPath,
value: &'life3 FieldValue,
) -> Pin<Box<dyn Future<Output = Result<AnomalyReport, AnomalyError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait;
fn baseline<'life0, 'life1, 'async_trait>(
&'life0 self,
schema_id: &'life1 SchemaId,
) -> Pin<Box<dyn Future<Output = Result<SchemaBaseline, AnomalyError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn reset<'life0, 'life1, 'async_trait>(
&'life0 self,
schema_id: &'life1 SchemaId,
) -> Pin<Box<dyn Future<Output = Result<(), AnomalyError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
}Expand description
Port trait: observe a field value, baseline reset on schema change.
Required Methods§
Sourcefn observe<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
schema_id: &'life1 SchemaId,
field: &'life2 FieldPath,
value: &'life3 FieldValue,
) -> Pin<Box<dyn Future<Output = Result<AnomalyReport, AnomalyError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn observe<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
schema_id: &'life1 SchemaId,
field: &'life2 FieldPath,
value: &'life3 FieldValue,
) -> Pin<Box<dyn Future<Output = Result<AnomalyReport, AnomalyError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Observe one field value. Returns AnomalyReport::signal
describing any anomaly detected, or AnomalySignal::None
if the value is consistent with the rolling baseline.
§Errors
Returns AnomalyError::Observe if the detector cannot
record the observation.
Sourcefn baseline<'life0, 'life1, 'async_trait>(
&'life0 self,
schema_id: &'life1 SchemaId,
) -> Pin<Box<dyn Future<Output = Result<SchemaBaseline, AnomalyError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn baseline<'life0, 'life1, 'async_trait>(
&'life0 self,
schema_id: &'life1 SchemaId,
) -> Pin<Box<dyn Future<Output = Result<SchemaBaseline, AnomalyError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Return the current baseline for a schema.
Sourcefn reset<'life0, 'life1, 'async_trait>(
&'life0 self,
schema_id: &'life1 SchemaId,
) -> Pin<Box<dyn Future<Output = Result<(), AnomalyError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn reset<'life0, 'life1, 'async_trait>(
&'life0 self,
schema_id: &'life1 SchemaId,
) -> Pin<Box<dyn Future<Output = Result<(), AnomalyError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Drop the rolling state for a schema. Used by callers that want to force a fresh baseline (e.g. after a backfill).
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".