Skip to content

Commit

Permalink
fix: bug in Critical Missed Proposes alert
Browse files Browse the repository at this point in the history
Due to incorrect conditions for the `CriticalMissedProposes` alert
triggering, the alert was not fired if this alert had never been
triggered previously. Now this bug is fixed.
  • Loading branch information
AlexanderLukin committed Oct 22, 2024
1 parent 8e5d225 commit 81b76a3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/common/alertmanager/alerts/CriticalMissedProposes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,10 @@ export class CriticalMissedProposes extends Alert {
for (const [operator, operatorResult] of Object.entries(ruleResult)) {
const prevAll = sentAlerts[this.alertname]?.ruleResult[operator]?.all ?? 0;
const prevMissed = sentAlerts[this.alertname]?.ruleResult[operator]?.missed ?? 0;
const prevMissedShare = prevAll === 0 ? 0 : prevMissed / prevAll;

// if math relation of missed to all increased
if (operatorResult.missed / operatorResult.all > prevMissed / prevAll && this.sendTimestamp - prevSendTimestamp > defaultInterval)
if (operatorResult.missed / operatorResult.all > prevMissedShare && this.sendTimestamp - prevSendTimestamp > defaultInterval)
return true;
}
}
Expand Down

0 comments on commit 81b76a3

Please sign in to comment.