> This page is for NeMo Relay, version v0.9.4.
> For other versions, use one of these documentation indexes:
> - Latest (v0.10.0) (default): https://docs.nvidia.com/nemo/relay/latest/llms.txt
> - dev: https://docs.nvidia.com/nemo/relay/dev/llms.txt
> - v0.10.0: https://docs.nvidia.com/nemo/relay/v0.10.0/llms.txt
> - v0.9.4: https://docs.nvidia.com/nemo/relay/v0.9.4/llms.txt
> - v0.8.4: https://docs.nvidia.com/nemo/relay/v0.8.4/llms.txt
> - v0.7.3: https://docs.nvidia.com/nemo/relay/v0.7.3/llms.txt
> - v0.6.0: https://docs.nvidia.com/nemo/relay/v0.6.0/llms.txt
> - v0.5.0: https://docs.nvidia.com/nemo/relay/v0.5.0/llms.txt

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.nvidia.com/nemo/relay/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.nvidia.com/nemo/relay/_mcp/server.

# Struct Running Stats

> Streaming statistics tracker combining Welford's online algorithm for mean/variance with a TDigest for streaming percentile estimation.

Generated from `cargo doc --no-deps -p nemo-relay -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`.

<pre />

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`

<pre />

#### `new`

<pre />

Creates a new empty `RunningStats`.

#### `has_samples`

<pre />

Returns `true` if any samples have been added.

#### `add_sample`

<pre />

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`

<pre />

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`

<pre />

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`

<pre />

#### `clone`

<pre />

#### `clone_from`

<pre />

### `impl Debug for RunningStats`

<pre />

#### `fmt`

<pre />

### `impl Default for RunningStats`

<pre />

#### `default`

<pre />

### `impl<'de> Deserialize<'de> for RunningStats`

<pre />

#### `deserialize`

<pre />

### `impl Serialize for RunningStats`

<pre />

#### `serialize`

<pre />