summaryrefslogtreecommitdiff
path: root/kafka/metrics/compound_stat.py
diff options
context:
space:
mode:
authorZack Dever <zdever@pandora.com>2016-04-07 18:36:14 -0700
committerZack Dever <zdever@pandora.com>2016-04-13 17:26:38 -0700
commit64e9cebfa5e883464cfe76af0c3476ae542ac17b (patch)
tree0f011c36c12076df940f49d5b58fd16b46e9b5b6 /kafka/metrics/compound_stat.py
parent0c94b83a2dff8113b5fd7c16df8a11ca03c4377b (diff)
downloadkafka-python-64e9cebfa5e883464cfe76af0c3476ae542ac17b.tar.gz
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.
Diffstat (limited to 'kafka/metrics/compound_stat.py')
-rw-r--r--kafka/metrics/compound_stat.py32
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