For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
  • About NVIDIA NeMo Relay
    • Overview
    • Architecture
    • Ecosystem
    • Concepts
    • Release Notes
  • Getting Started
    • Agent Runtime Primer
    • Prerequisites
    • Installation
    • Configuration / Setup
    • Quick Start
  • NVIDIA NeMo Relay CLI
    • About
    • Basic Usage
    • Claude Code
    • Codex
    • Cursor
    • Hermes Agent
  • Supported Integrations
    • About
    • OpenClaw Plugin Guide
    • LangChain Integration Guide
    • LangGraph Integration Guide
    • Deep Agents Integration Guide
  • Instrument Applications
    • About
    • Adding Scopes and Marks
    • Instrument a Tool Call
    • Instrument an LLM Call
    • Add Middleware
    • Code Examples
  • Observability Plugin
    • About
    • Configuration
    • Agent Trajectory Interchange Format (ATIF)
    • Agent Trajectory Observability Format (ATOF)
    • OpenTelemetry
    • OpenInference
  • Adaptive Plugin
    • About
    • Configuration
    • Adaptive Cache Governor (ACG)
    • Adaptive Hints
  • NeMo Guardrails Plugin
    • About
    • Configuration
  • Integrate into Frameworks
    • About
    • Adding Scopes
    • Wrap Tool Calls
    • Wrap LLM Calls
    • Handle Non-Serializable Data
    • Using Codecs
    • Provider Codecs
    • Provider Response Codecs
    • Code Examples
  • Build Plugins
    • About
    • Define a Plugin
    • Validate Plugin Configuration
    • Plugin Configuration Files
    • Register Plugin Behavior
    • Design Plugin Configuration
    • NeMo Guardrails Example Plugin
    • Code Examples
  • Contribute
    • About
    • Development Setup
    • Workflow and Reviews
    • Testing and Documentation
  • Reference
    • APIs
      • Python Library Reference
      • Node.js Library Reference
      • Rust Library Reference
        • nemo-relay
        • nemo-relay-adaptive
          • acg
          • acg_component
          • acg_learner
          • acg_profile
          • adaptive_hints_intercept
          • cache_diagnostics
          • config
          • context_helpers
          • drain
          • error
          • intercepts
          • learner
          • plugin_component
          • redis
          • storage
          • subscriber
          • tool_parallelism_learner
          • trie
            • accumulator
              • AccumulatorState
              • NodeAccumulators
              • RunningStats
            • builder
            • data_models
            • lookup
            • serialization
          • types
          • AdaptiveRuntime
        • nemo-relay-ffi
    • Performance
  • Resources
    • Support and FAQs
    • Glossary
    • Troubleshooting Guide
    • Community
    • Legal
NVIDIANVIDIA
Developer-friendly docs for your API
Privacy Policy | Your Privacy Choices | Terms of Service | Accessibility | Corporate Policies | Product Security | Contact

Copyright © 2026, NVIDIA Corporation.

LogoLogo
On this page
  • Fields
  • count: u64
  • mean: f64
  • m2: f64
  • digest: TDigest
  • Implementations
  • impl RunningStats
  • new
  • has_samples
  • add_sample
  • merge
  • compute_metrics
  • Trait Implementations
  • impl Clone for RunningStats
  • clone
  • clone_from
  • impl Debug for RunningStats
  • fmt
  • impl Default for RunningStats
  • default
  • impl<'de> Deserialize<'de> for RunningStats
  • deserialize
  • impl Serialize for RunningStats
  • serialize
ReferenceAPIsRust Library Referencenemo-relay-adaptivetrieaccumulator

Struct Running Stats

||View as Markdown|
Previous

Struct Node Accumulators

Next

Module builder

Generated from cargo doc --no-deps -p nemo-relay -p nemo-relay-adaptive -p nemo-relay-ffi.

pub struct RunningStats {
    pub count: u64,
    pub mean: f64,
    pub m2: f64,
    pub digest: TDigest,
}

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

impl RunningStats

new

pub fn new() -> Self

Creates a new empty RunningStats.

has_samples

pub fn has_samples(&self) -> bool

Returns true if any samples have been added.

add_sample

pub fn add_sample(&mut self, value: 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

pub fn merge(&mut self, other: &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

pub fn compute_metrics(&self) -> 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

impl Clone for RunningStats

clone

fn clone(&self) -> RunningStats

clone_from

fn clone_from(&mut self, source: &Self)

impl Debug for RunningStats

impl Debug for RunningStats

fmt

fn fmt(&self, f: &mut Formatter<'_>) -> Result

impl Default for RunningStats

impl Default for RunningStats

default

fn default() -> Self

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

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

deserialize

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
    __D: Deserializer<'de>,

impl Serialize for RunningStats

impl Serialize for RunningStats

serialize

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>where
    __S: Serializer,