summaryrefslogtreecommitdiff
path: root/kafka/metrics/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/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/stat.py')
-rw-r--r--kafka/metrics/stat.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/kafka/metrics/stat.py b/kafka/metrics/stat.py
new file mode 100644
index 0000000..c10f3ce
--- /dev/null
+++ b/kafka/metrics/stat.py
@@ -0,0 +1,21 @@
+import abc
+
+
+class AbstractStat(object):
+ """
+ An AbstractStat is a quantity such as average, max, etc that is computed
+ off the stream of updates to a sensor
+ """
+ __metaclass__ = abc.ABCMeta
+
+ @abc.abstractmethod
+ def record(self, config, value, time_ms):
+ """
+ Record the given value
+
+ Arguments:
+ config (MetricConfig): The configuration to use for this metric
+ value (float): The value to record
+ timeMs (int): The POSIX time in milliseconds this value occurred
+ """
+ raise NotImplementedError