Struct Running Stats
Generated from cargo doc --no-deps -p nemo-relay-builtins -p nemo-relay-diagnostics -p nemo-relay-logging -p nemo-relay-plugin-host -p nemo-relay-codecs -p nemo-relay -p nemo-relay-runtime -p nemo-relay-model-pricing -p nemo-relay-resource-metrics -p nemo-relay-observability -p nemo-relay-adaptive -p nemo-relay-pii-redaction -p nemo-relay-ffi -p nemo-relay-types -p nemo-relay-plugin -p nemo-relay-worker-proto -p nemo-relay-worker.
Streaming statistics tracker combining Welford’s online algorithm for mean/variance with a TDigest for streaming percentile estimation.
This replaces NAT’s batch MetricsAccumulator which stores all raw samples. RunningStats provides O(1) memory usage with merge() support for incremental trie updates.
Fields
count: u64
Number of samples added.
mean: f64
Running mean (Welford).
m2: f64
Sum of squared differences from the mean (Welford M2).
digest: TDigest
TDigest for streaming percentile estimation.
Uses custom serde to handle NaN min/max in empty digests.
Implementations
impl RunningStats
Referenced types: RunningStats
new
Creates a new empty RunningStats.
has_samples
Referenced types: bool
Returns true if any samples have been added.
add_sample
Referenced types: f64
Adds a single sample, updating both Welford accumulators and TDigest.
Welford’s online algorithm maintains running mean and M2 (sum of squared differences from the mean). TDigest is updated via merge_unsorted which returns a new digest (it consumes self by value).
merge
Referenced types: RunningStats
Merges another RunningStats into this one using parallel Welford merge and TDigest merge_digests.
If other is empty, this is a no-op.
compute_metrics
Referenced types: PredictionMetrics
Computes PredictionMetrics from the current accumulator state.
Returns PredictionMetrics::default() if no samples have been added. Percentiles (p50, p90, p95) are estimated from the TDigest.
Trait Implementations
impl Clone for RunningStats
Referenced types: Clone, RunningStats
clone
Referenced types: clone, RunningStats
clone_from
Referenced types: clone_from
impl Debug for RunningStats
Referenced types: Debug, RunningStats
fmt
Referenced types: fmt, Formatter, Result
impl Default for RunningStats
Referenced types: Default, RunningStats
default
Referenced types: default
impl<'de> Deserialize<'de> for RunningStats
Referenced types: Deserialize, RunningStats
deserialize
Referenced types: deserialize, Result, Error, Deserializer
impl Serialize for RunningStats
Referenced types: Serialize, RunningStats
serialize
Referenced types: serialize, Result, Ok, Error, Serializer