Skip to main content

FieldAnomalyDetector

Trait FieldAnomalyDetector 

Source
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§

Source

fn name(&self) -> &'static str

Stable name for diagnostics.

Source

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.

Source

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.

Source

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".

Implementors§