Skip to content

counter_series:sum_over

series:sum_over(duration)
Since: Version 2026.05.12-a6845223

The functionality described in this section requires version 2026.05.12-a6845223 of KumoMTA, or a more recent version.

Returns the rolling total over the requested time span.

  • duration — span to sum over. Accepts an integer number of seconds, or a duration string such as "30s", "5m".

The duration is rounded up to a whole number of buckets, so a span shorter than bucket_size still includes the current bucket. The effective span is also capped at num_buckets * bucket_size; requesting a longer span is equivalent to calling sum.

Calling sum_over also rotates the ring buffer, so any buckets that have aged out since the last access are zeroed before the result is computed.

Example

local series = kumo.counter_series.define {
  name = 'deliveries.ok',
  num_buckets = 5,
  bucket_size = '1m',
}
print('last 2 minutes:', series:sum_over '2m')