TimelessMetrics.Aggregation (timeless_metrics v6.0.12)

Copy Markdown View Source

Shared aggregation helpers for the actor engine.

Extracted from TimelessMetrics.Query — bucket_to_seconds, compute_aggregate, and bucket_points are needed by both the sharded query engine and the actor engine's in-process aggregation.

Summary

Functions

Group points into time buckets and compute an aggregate per bucket.

Convert a bucket spec to seconds.

Compute an aggregate value from a list of values.

Functions

bucket_points(points, bucket_seconds, agg_fn)

Group points into time buckets and compute an aggregate per bucket.

Returns [{bucket_timestamp, aggregate_value}, ...] sorted by timestamp.

bucket_to_seconds(n)

Convert a bucket spec to seconds.

compute_aggregate(atom, values, points)

Compute an aggregate value from a list of values.