From 8916d51e2bc82eae33bd01a1231b853b37e94c8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Ma=C5=9Blanka?= <pmaslanka@smok.co> Date: Fri, 1 Oct 2021 19:22:31 +0200 Subject: [PATCH] ver bump + un-deprecated the `cps` metric --- CHANGELOG.md | 4 ++-- docs/instrumentation/metrics.rst | 3 +++ satella/__init__.py | 2 +- satella/instrumentation/metrics/metric_types/cps.py | 10 +++------- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 00a244bb..7e7d3a83 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,3 @@ -# v2.17.22 +# v2.17.23 -* added empty context manager +* un-deprecated the `cps` metric diff --git a/docs/instrumentation/metrics.rst b/docs/instrumentation/metrics.rst index 932d0586..1f48e590 100644 --- a/docs/instrumentation/metrics.rst +++ b/docs/instrumentation/metrics.rst @@ -85,6 +85,9 @@ are available: .. autoclass:: satella.instrumentation.metrics.metric_types.ClicksPerTimeUnitMetric :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 .. autoclass:: satella.instrumentation.metrics.metric_types.LinkfailMetric diff --git a/satella/__init__.py b/satella/__init__.py index fead275c..90911dcd 100644 --- a/satella/__init__.py +++ b/satella/__init__.py @@ -1 +1 @@ -__version__ = '2.17.22' +__version__ = '2.17.23a1' diff --git a/satella/instrumentation/metrics/metric_types/cps.py b/satella/instrumentation/metrics/metric_types/cps.py index ee103601..72ef9e51 100644 --- a/satella/instrumentation/metrics/metric_types/cps.py +++ b/satella/instrumentation/metrics/metric_types/cps.py @@ -1,7 +1,6 @@ import collections import time import typing as tp -import warnings from .base import EmbeddedSubmetrics from .registry import register_metric @@ -16,18 +15,15 @@ class ClicksPerTimeUnitMetric(EmbeddedSubmetrics): By default (if you do not specify otherwise) this will track calls made during the last second. - .. deprecated:: 2.14.22 - Use :class:`~satella.instrumentation.metrics.metric_types.CounterMetric` instead + This was once deprecated but out of platforms which suck at calculating derivatives of their + 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' def __init__(self, *args, time_unit_vectors: tp.Optional[tp.List[float]] = None, 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) time_unit_vectors = time_unit_vectors or [1] self.last_clicks = collections.deque() # type: tp.List[float] -- GitLab