alerting: stop using rule group idx to calculate alert fingerprint (#106407)

pull/106539/head
Tito Lins 1 month ago committed by GitHub
parent 6af09ed763
commit 7688089a57
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 1
      pkg/services/ngalert/schedule/registry.go
  2. 3
      pkg/services/ngalert/schedule/registry_test.go

@ -318,7 +318,6 @@ func (r ruleWithFolder) Fingerprint() fingerprint {
writeInt(*rule.PanelID)
}
writeString(rule.RuleGroup)
writeInt(int64(rule.RuleGroupIndex))
writeString(string(rule.NoDataState))
writeString(string(rule.ExecErrState))
if rule.Record != nil {

@ -152,13 +152,14 @@ func TestRuleWithFolderFingerprint(t *testing.T) {
f2 := ruleWithFolder{rule: rule, folderTitle: uuid.NewString()}.Fingerprint()
require.NotEqual(t, f, f2)
})
t.Run("Version, Updated, IntervalSeconds, GUID and Annotations should be excluded from fingerprint", func(t *testing.T) {
t.Run("Version, Updated, IntervalSeconds, GUID, Annotations and RuleGroupIndex should be excluded from fingerprint", func(t *testing.T) {
cp := models.CopyRule(rule)
cp.Version++
cp.Updated = cp.Updated.Add(1 * time.Second)
cp.IntervalSeconds++
cp.Annotations = make(map[string]string)
cp.Annotations["test"] = "test"
cp.RuleGroupIndex++
cp.GUID = uuid.NewString()
f2 := ruleWithFolder{rule: cp, folderTitle: title}.Fingerprint()

Loading…
Cancel
Save