summaryrefslogtreecommitdiff
path: root/kafka/metrics/stats/total.py
blob: 76a82d8def7ebc4546fb02fc6918f86122f4007e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
from kafka.metrics.measurable_stat import AbstractMeasurableStat


class Total(AbstractMeasurableStat):
    """An un-windowed cumulative total maintained over all time."""
    def __init__(self, value=0.0):
        self._total = value

    def record(self, config, value, now):
        self._total += value

    def measure(self, config, now):
        return float(self._total)