Skip to content

Commit

Permalink
Merge pull request #7 from fellowapp/false-positive-burst-limit-reached
Browse files Browse the repository at this point in the history
Fix reporting burst limit reached when it was not
  • Loading branch information
p7g authored Mar 27, 2023
2 parents 5a5405b + 5d0f16c commit 7d7b011
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 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
2 changes: 1 addition & 1 deletion riotfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
},
),
Venv(
pkgs={"black": "==20.8b1"},
pkgs={"black": "==22.3.0"},
venvs=[
Venv(
name="fmt",
Expand Down

0 comments on commit 7d7b011

Please sign in to comment.