m2m模型翻译
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
776 B

7 months ago
  1. from __future__ import absolute_import
  2. import abc
  3. from kafka.metrics.stat import AbstractStat
  4. class AbstractCompoundStat(AbstractStat):
  5. """
  6. A compound stat is a stat where a single measurement and associated
  7. data structure feeds many metrics. This is the example for a
  8. histogram which has many associated percentiles.
  9. """
  10. __metaclass__ = abc.ABCMeta
  11. def stats(self):
  12. """
  13. Return list of NamedMeasurable
  14. """
  15. raise NotImplementedError
  16. class NamedMeasurable(object):
  17. def __init__(self, metric_name, measurable_stat):
  18. self._name = metric_name
  19. self._stat = measurable_stat
  20. @property
  21. def name(self):
  22. return self._name
  23. @property
  24. def stat(self):
  25. return self._stat