/
base.py
32 lines (24 loc) · 1.01 KB
/
base.py
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
from __future__ import (
absolute_import,
unicode_literals,
)
import abc
from typing import Iterable
import six
from pymetrics.instruments import Metric
__all__ = (
'MetricsPublisher',
)
@six.add_metaclass(abc.ABCMeta)
class MetricsPublisher(object):
@abc.abstractmethod
def publish(self, metrics, error_logger=None, enable_meta_metrics=False):
# type: (Iterable[Metric], six.text_type, bool) -> None
"""
Publish the provided metrics in the manner prescribed by the implementation's documentation.
:param metrics: An iterable of all metrics that should be published
:param error_logger: The name of the error logger that should be used if an error occurs (if no error logger
name is provided, errors will be suppressed)
:param enable_meta_metrics: If `True`, metrics about the performance of this publisher will also be recorded
(not all publishers will have meta-metrics to record).
"""