diff --git a/asyncio_connection_pool/contrib/datadog.py b/asyncio_connection_pool/contrib/datadog.py index f948a6c..2b96843 100644 --- a/asyncio_connection_pool/contrib/datadog.py +++ b/asyncio_connection_pool/contrib/datadog.py @@ -53,6 +53,17 @@ def _record_pressure(self): alert_type="warning", tags=self._extra_tags, ) + if ( + self._total == self.burst_limit + and not self._reported_hitting_burst_limit + ): + self._reported_hitting_burst_limit = True + statsd.event( + f"{self._service_name} pool reached burst limit", + "There are not enough redis connections to satisfy all users", + alert_type="error", + tags=self._extra_tags, + ) elif self._is_bursting: self._is_bursting = False self._reported_hitting_burst_limit = False @@ -62,14 +73,6 @@ def _record_pressure(self): alert_type="success", tags=self._extra_tags, ) - if self._total == self.burst_limit: - self._reported_hitting_burst_limit = True - statsd.event( - f"{self._service_name} pool reached burst limit", - "There are not enough redis connections to satisfy all users", - alert_type="error", - tags=self._extra_tags, - ) def _record_connection_acquiring(self, value=0): self._connections_acquiring += value diff --git a/riotfile.py b/riotfile.py index 4a9be03..0a0c4d5 100644 --- a/riotfile.py +++ b/riotfile.py @@ -25,7 +25,7 @@ }, ), Venv( - pkgs={"black": "==20.8b1"}, + pkgs={"black": "==22.3.0"}, venvs=[ Venv( name="fmt",