diff options
author | Zack Dever <zackdever@gmail.com> | 2016-04-14 11:02:01 -0700 |
---|---|---|
committer | Zack Dever <zackdever@gmail.com> | 2016-04-14 11:02:01 -0700 |
commit | cf679ae387519f658f17b2da2d05ff84834cb1f5 (patch) | |
tree | 5618627ab6919b6fd4cd476e801c0f9bf449d716 /kafka/metrics/compound_stat.py | |
parent | 0c94b83a2dff8113b5fd7c16df8a11ca03c4377b (diff) | |
parent | e2b340c4408801515f5e924aec066af983aa5c57 (diff) | |
download | kafka-python-cf679ae387519f658f17b2da2d05ff84834cb1f5.tar.gz |
Merge pull request #637 from zackdever/metrics
Metrics java port
Diffstat (limited to 'kafka/metrics/compound_stat.py')
-rw-r--r-- | kafka/metrics/compound_stat.py | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/kafka/metrics/compound_stat.py b/kafka/metrics/compound_stat.py new file mode 100644 index 0000000..09bc24a --- /dev/null +++ b/kafka/metrics/compound_stat.py @@ -0,0 +1,32 @@ +import abc + +from kafka.metrics.stat import AbstractStat + + +class AbstractCompoundStat(AbstractStat): + """ + A compound stat is a stat where a single measurement and associated + data structure feeds many metrics. This is the example for a + histogram which has many associated percentiles. + """ + __metaclass__ = abc.ABCMeta + + def stats(self): + """ + Return list of NamedMeasurable + """ + raise NotImplementedError + + +class NamedMeasurable(object): + def __init__(self, metric_name, measurable_stat): + self._name = metric_name + self._stat = measurable_stat + + @property + def name(self): + return self._name + + @property + def stat(self): + return self._stat |