Skip to content
Snippets Groups Projects
Commit 8916d51e authored by Piotr Maślanka's avatar Piotr Maślanka
Browse files

ver bump + un-deprecated the `cps` metric

parent 65e4c087
No related branches found
No related tags found
No related merge requests found
# v2.17.22 # v2.17.23
* added empty context manager * un-deprecated the `cps` metric
...@@ -85,6 +85,9 @@ are available: ...@@ -85,6 +85,9 @@ are available:
.. autoclass:: satella.instrumentation.metrics.metric_types.ClicksPerTimeUnitMetric .. autoclass:: satella.instrumentation.metrics.metric_types.ClicksPerTimeUnitMetric
:members: :members:
.. note:: Normally you should use a counter and calculate a rate() from it, but since some
platforms suck at rate a decision was made to keep this.
* linkfail - for tracking whether given link is online or offline * linkfail - for tracking whether given link is online or offline
.. autoclass:: satella.instrumentation.metrics.metric_types.LinkfailMetric .. autoclass:: satella.instrumentation.metrics.metric_types.LinkfailMetric
......
__version__ = '2.17.22' __version__ = '2.17.23a1'
import collections import collections
import time import time
import typing as tp import typing as tp
import warnings
from .base import EmbeddedSubmetrics from .base import EmbeddedSubmetrics
from .registry import register_metric from .registry import register_metric
...@@ -16,18 +15,15 @@ class ClicksPerTimeUnitMetric(EmbeddedSubmetrics): ...@@ -16,18 +15,15 @@ class ClicksPerTimeUnitMetric(EmbeddedSubmetrics):
By default (if you do not specify otherwise) this will track calls made during the last second. By default (if you do not specify otherwise) this will track calls made during the last second.
.. deprecated:: 2.14.22 This was once deprecated but out of platforms which suck at calculating derivatives of their
Use :class:`~satella.instrumentation.metrics.metric_types.CounterMetric` instead series (AWS, I'm looking at you!) this was decided to be undeprecated.
""" """
__slots__ = ('last_clicks', 'aggregate_children', 'cutoff_period', 'time_unit_vectors') __slots__ = 'last_clicks', 'aggregate_children', 'cutoff_period', 'time_unit_vectors'
CLASS_NAME = 'cps' CLASS_NAME = 'cps'
def __init__(self, *args, time_unit_vectors: tp.Optional[tp.List[float]] = None, def __init__(self, *args, time_unit_vectors: tp.Optional[tp.List[float]] = None,
aggregate_children: bool = True, internal: bool = False, **kwargs): aggregate_children: bool = True, internal: bool = False, **kwargs):
warnings.warn('cps is deprecated and will be removed in Satella 3.0, '
'use a counter and calculate a rate() from it instead',
DeprecationWarning)
super().__init__(*args, internal=internal, time_unit_vectors=time_unit_vectors, **kwargs) super().__init__(*args, internal=internal, time_unit_vectors=time_unit_vectors, **kwargs)
time_unit_vectors = time_unit_vectors or [1] time_unit_vectors = time_unit_vectors or [1]
self.last_clicks = collections.deque() # type: tp.List[float] self.last_clicks = collections.deque() # type: tp.List[float]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment