Skip to content

feat: temporal distribution stats across resolution windows (stddev, median, percentile) #205

Description

@atheurer

Summary

When using --resolution X with an aggregation method (e.g., avg, sum), CDM divides the query time domain into X windows and returns one value per window. Currently there is no way to characterize the distribution of those window values — only to retrieve them individually.

This feature request adds a second aggregation pass over the per-window results, producing distribution statistics: min, max, median, mean, stddev, and percentiles.

Motivation

A single aggregate (e.g., "avg throughput = 20 Gbps") does not tell you whether the workload was stable or highly variable. For example:

  • A uperf run reporting 20 Gbps avg could mean a rock-steady 20 Gbps throughout, or wild swings between 5 Gbps and 35 Gbps that happen to average 20 Gbps.
  • Coefficient of variation (stddev / mean) is a useful signal for deciding whether a benchmark result is trustworthy.
  • Agentic consumers of CDM data need this to assess result quality without downloading all raw samples.

Proposed behavior

For a query with --resolution N and aggregation method M:

  1. (existing) Divide the time domain into N windows; compute aggregate M within each window → N values.
  2. (new) Over those N values, compute and return: min, max, mean, median, stddev, and optionally pNN (e.g., p95, p99).

This is most meaningful for avg and sum aggregations (where the window values are commensurable), but could be offered for min/max as well.

Example use case

cdm query --metric network_throughput \
          --resolution 10 \
          --aggregation avg \
          --temporal-stats stddev,p95,min,max

Returns: per-window avg values plus stddev=X, p95=Y, min=Z, max=W across those 10 windows.

Alternatives considered

  • Returning all raw per-window values and letting the caller compute stats — works but wastes bandwidth and shifts complexity to every consumer.
  • A separate --distribution query type — possible but adds API surface unnecessarily if it's just a flag on existing resolution queries.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status
Queued

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions