collections/timeseries_buffer_utils library
Time-series buffer that keeps recent raw points and down-samples old ones — roadmap #510.
Dashboards and sparkline widgets want full resolution for the most recent
span but only summary statistics for older history, and they cannot grow
without bound. This buffer keeps the last rawCapacity points verbatim;
when a new point pushes an old one out, that evicted point is folded into a
fixed-width time bucket holding count / sum / min / max. The result is a
bounded structure that answers "exact recent values" and "aggregated older
trend" from the same feed.
Points must be added in non-decreasing timestamp order — the eviction logic assumes the oldest raw point is always the front of the buffer.
Classes
- TimeBucket
- A down-sampled aggregate over one fixed-width time bucket.
- TimeSeriesBuffer
- A bounded time-series buffer mixing raw recent points and older aggregates.