File: compound_stat.py

package info (click to toggle)
python-kafka 2.0.2-9
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,740 kB
  • sloc: python: 20,457; makefile: 210; sh: 76
file content (34 lines) | stat: -rw-r--r-- 776 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
from __future__ import absolute_import

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