Skip to main content

TelemetryAdapter

Trait TelemetryAdapter 

Source
pub trait TelemetryAdapter<T> {
    // Required method
    fn adapt(&self, input: &T) -> ResidualSample;
}
Expand description

Adapter from an application-specific telemetry record into a DSFB sample.

§Example

use dsfb_gray::{ResidualSample, ResidualSource, TelemetryAdapter};

struct LatencyPoint {
    p95_ns: u64,
    baseline_ns: u64,
    ts_ns: u64,
}

struct LatencyAdapter;

impl TelemetryAdapter<LatencyPoint> for LatencyAdapter {
    fn adapt(&self, input: &LatencyPoint) -> ResidualSample {
        ResidualSample {
            value: input.p95_ns as f64,
            baseline: input.baseline_ns as f64,
            timestamp_ns: input.ts_ns,
            source: ResidualSource::Latency,
        }
    }
}

Required Methods§

Source

fn adapt(&self, input: &T) -> ResidualSample

Convert one application-specific telemetry record into a DSFB sample.

Implementors§