Fix alert -1 count (#16359)

This commit is contained in:
Steve Calvário 2024-09-04 22:04:06 +01:00 committed by GitHub
parent 8aab71a947
commit 40b629011f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -416,7 +416,8 @@ class RunAlerts
}
if ($alert['state'] == AlertState::ACTIVE && ! empty($rextra['count']) && ($rextra['count'] == -1 || $alert['details']['count']++ < $rextra['count'])) {
if ($alert['details']['count'] < $rextra['count']) {
// We don't want -1 alert rule count alarms to get muted because of the current alert count
if ($alert['details']['count'] < $rextra['count'] || $rextra['count'] == -1) {
$noacc = true;
}
@ -439,7 +440,8 @@ class RunAlerts
}
if (in_array($alert['state'], [AlertState::ACTIVE, AlertState::WORSE, AlertState::BETTER]) && ! empty($rextra['count']) && ($rextra['count'] == -1 || $alert['details']['count']++ < $rextra['count'])) {
if ($alert['details']['count'] < $rextra['count']) {
// We don't want -1 alert rule count alarms to get muted because of the current alert count
if ($alert['details']['count'] < $rextra['count'] || $rextra['count'] == -1) {
$noacc = true;
}