Files
deb-python-kafka/kafka/metrics/stats/count.py
Zack Dever 64e9cebfa5 Kafka metrics java port. No reporters or instrumentation.
There is no straight translation for the JMX reporter into python,
so I'll do something else in a separate commit.
2016-04-13 17:26:38 -07:00

16 lines
447 B
Python

from kafka.metrics.stats.sampled_stat import AbstractSampledStat
class Count(AbstractSampledStat):
"""
An AbstractSampledStat that maintains a simple count of what it has seen.
"""
def __init__(self):
super(Count, self).__init__(0.0)
def update(self, sample, config, value, now):
sample.value += 1.0
def combine(self, samples, config, now):
return float(sum(sample.value for sample in samples))