diff --git a/docs/sources/alerting/migrating-alerts/migrating-legacy-alerts.md b/docs/sources/alerting/migrating-alerts/migrating-legacy-alerts.md index 35ba9a52f14..74f42177c16 100644 --- a/docs/sources/alerting/migrating-alerts/migrating-legacy-alerts.md +++ b/docs/sources/alerting/migrating-alerts/migrating-legacy-alerts.md @@ -41,4 +41,3 @@ longer supported. We refer to these as [Differences]({{< relref "#differences" > ## Limitations 1. Since `Hipchat` and `Sensu` notification channels are no longer supported, legacy alerts associated with these channels are not automatically migrated to Grafana Alerting. Assign the legacy alerts to a supported notification channel so that you continue to receive notifications for those alerts. - Silences (expiring after one year) are created for all paused dashboard alerts. diff --git a/pkg/services/sqlstore/migrations/ualert/alert_rule.go b/pkg/services/sqlstore/migrations/ualert/alert_rule.go index d4319dd7974..7bacef0bd19 100644 --- a/pkg/services/sqlstore/migrations/ualert/alert_rule.go +++ b/pkg/services/sqlstore/migrations/ualert/alert_rule.go @@ -152,10 +152,6 @@ func (m *migration) makeAlertRule(l log.Logger, cond condition, da dashAlert, fo n, v := getLabelForSilenceMatching(ar.UID) ar.Labels[n] = v - if err := m.addSilence(da, ar); err != nil { - m.mg.Logger.Error("alert migration error: failed to create silence", "rule_name", ar.Title, "err", err) - } - if err := m.addErrorSilence(da, ar); err != nil { m.mg.Logger.Error("alert migration error: failed to create silence for Error", "rule_name", ar.Title, "err", err) } diff --git a/pkg/services/sqlstore/migrations/ualert/silences.go b/pkg/services/sqlstore/migrations/ualert/silences.go index c5fdfbf1948..69d1a2b320c 100644 --- a/pkg/services/sqlstore/migrations/ualert/silences.go +++ b/pkg/services/sqlstore/migrations/ualert/silences.go @@ -26,43 +26,6 @@ const ( ErrorAlertName = "DatasourceError" ) -func (m *migration) addSilence(da dashAlert, rule *alertRule) error { - if da.State != "paused" { - return nil - } - - uid, err := uuid.NewRandom() - if err != nil { - return errors.New("failed to create uuid for silence") - } - - n, v := getLabelForSilenceMatching(rule.UID) - s := &pb.MeshSilence{ - Silence: &pb.Silence{ - Id: uid.String(), - Matchers: []*pb.Matcher{ - { - Type: pb.Matcher_EQUAL, - Name: n, - Pattern: v, - }, - }, - StartsAt: time.Now(), - EndsAt: time.Now().Add(365 * 20 * time.Hour), // 1 year. - CreatedBy: "Grafana Migration", - Comment: "Created during auto migration to unified alerting", - }, - ExpiresAt: time.Now().Add(365 * 20 * time.Hour), // 1 year. - } - - _, ok := m.silences[da.OrgId] - if !ok { - m.silences[da.OrgId] = make([]*pb.MeshSilence, 0) - } - m.silences[da.OrgId] = append(m.silences[da.OrgId], s) - return nil -} - func (m *migration) addErrorSilence(da dashAlert, rule *alertRule) error { if da.ParsedSettings.ExecutionErrorState != "keep_state" { return nil