summaryrefslogtreecommitdiff
path: root/kafka/metrics/metrics_reporter.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/metrics_reporter.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/metrics_reporter.py')
-rw-r--r--kafka/metrics/metrics_reporter.py55
1 files changed, 55 insertions, 0 deletions
diff --git a/kafka/metrics/metrics_reporter.py b/kafka/metrics/metrics_reporter.py
new file mode 100644
index 0000000..b48ad0b
--- /dev/null
+++ b/kafka/metrics/metrics_reporter.py
@@ -0,0 +1,55 @@
+import abc
+
+
+class AbstractMetricsReporter(object):
+ """
+ An abstract class to allow things to listen as new metrics
+ are created so they can be reported.
+ """
+ __metaclass__ = abc.ABCMeta
+
+ @abc.abstractmethod
+ def init(self, metrics):
+ """
+ This is called when the reporter is first registered
+ to initially register all existing metrics
+
+ Arguments:
+ metrics (list of KafkaMetric): All currently existing metrics
+ """
+ raise NotImplementedError
+
+ @abc.abstractmethod
+ def metric_change(self, metric):
+ """
+ This is called whenever a metric is updated or added
+
+ Arguments:
+ metric (KafkaMetric)
+ """
+ raise NotImplementedError
+
+ @abc.abstractmethod
+ def metric_removal(self, metric):
+ """
+ This is called whenever a metric is removed
+
+ Arguments:
+ metric (KafkaMetric)
+ """
+ raise NotImplementedError
+
+ @abc.abstractmethod
+ def configure(self, configs):
+ """
+ Configure this class with the given key-value pairs
+
+ Arguments:
+ configs (dict of {str, ?})
+ """
+ raise NotImplementedError
+
+ @abc.abstractmethod
+ def close(self):
+ """Called when the metrics repository is closed."""
+ raise NotImplementedError