Skip to content

Commit

Permalink
fix reporting burst limit hit when it wasn't
Browse files Browse the repository at this point in the history
  • Loading branch information
p7g committed Mar 29, 2022
1 parent 5a5405b commit 2d23618
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions asyncio_connection_pool/contrib/datadog.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 2d23618

Please sign in to comment.