diff --git a/pkg/services/ngalert/state/cache.go b/pkg/services/ngalert/state/cache.go index 461d6f9f2c6..2e748325cca 100644 --- a/pkg/services/ngalert/state/cache.go +++ b/pkg/services/ngalert/state/cache.go @@ -56,16 +56,18 @@ func (rs *ruleStates) getOrCreate(ctx context.Context, log log.Logger, alertRule lbs[key] = val } for key, val := range ruleLabels { - _, ok := lbs[key] + ruleVal, ok := lbs[key] // if duplicate labels exist, reserved label will take precedence if ok { - dupes[key] = val + if ruleVal != val { + dupes[key] = val + } } else { lbs[key] = val } } if len(dupes) > 0 { - log.Warn("rule declares one or many reserved labels. Those rules labels will be ignored", "labels", dupes) + log.Warn("Rule declares one or many reserved labels. Those rules labels will be ignored", "labels", dupes) } dupes = make(data.Labels) for key, val := range result.Instance { diff --git a/pkg/services/sqlstore/migrations/ualert/alert_rule.go b/pkg/services/sqlstore/migrations/ualert/alert_rule.go index 653f62bcf5f..bb486ee6645 100644 --- a/pkg/services/sqlstore/migrations/ualert/alert_rule.go +++ b/pkg/services/sqlstore/migrations/ualert/alert_rule.go @@ -100,7 +100,6 @@ func addMigrationInfo(da *dashAlert) (map[string]string, map[string]string) { func (m *migration) makeAlertRule(cond condition, da dashAlert, folderUID string) (*alertRule, error) { lbls, annotations := addMigrationInfo(&da) name := normalizeRuleName(da.Name) - lbls["alertname"] = name annotations["message"] = da.Message var err error