> 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 full documentation content, see https://docs.nvidia.com/nemo/relay/llms-full.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-ffi`.

<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 />