Alerting: Use AlertRuleKey for comparison before rule evaluation (#98808)

(WIP) Alerting: Use AlertRuleKey for comparison before rule evaluation
pull/98820/head
Santiago 5 months ago committed by GitHub
parent b742896838
commit 86e8147df3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 2
      pkg/services/ngalert/schedule/alert_rule.go

@ -194,7 +194,7 @@ func (a *alertRule) Status() ngmodels.RuleStatus {
// //
// the second element contains a dropped message that was sent by a concurrent sender. // the second element contains a dropped message that was sent by a concurrent sender.
func (a *alertRule) Eval(eval *Evaluation) (bool, *Evaluation) { func (a *alertRule) Eval(eval *Evaluation) (bool, *Evaluation) {
if a.key != eval.rule.GetKeyWithGroup() { if a.key.AlertRuleKey != eval.rule.GetKey() {
// Make sure that rule has the same key. This should not happen // Make sure that rule has the same key. This should not happen
a.logger.Error("Invalid rule sent for evaluating. Skipping", "ruleKeyToEvaluate", eval.rule.GetKey().String()) a.logger.Error("Invalid rule sent for evaluating. Skipping", "ruleKeyToEvaluate", eval.rule.GetKey().String())
return false, eval return false, eval

Loading…
Cancel
Save