Skip to content

counter_series:sum

series:sum()
Since: Dev Builds Only

The functionality described in this section requires a dev build of KumoMTA. You can obtain a dev build by following the instructions in the Installation section.

Returns the rolling total across every bucket in the series — that is, the sum over the full retention span of num_buckets * bucket_size.

Use sum_over to total a shorter span.

Calling sum 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',
}
series:increment(3)
print('total over the last 5 minutes:', series:sum())