total.py 418 B

123456789101112131415
  1. from __future__ import absolute_import
  2. from kafka.metrics.measurable_stat import AbstractMeasurableStat
  3. class Total(AbstractMeasurableStat):
  4. """An un-windowed cumulative total maintained over all time."""
  5. def __init__(self, value=0.0):
  6. self._total = value
  7. def record(self, config, value, now):
  8. self._total += value
  9. def measure(self, config, now):
  10. return float(self._total)