Alerting: Skip setting up clustering in remote primary/only modes (#88968)

* Alerting: Skip setting up clustering in remote primary mode

* Update pkg/services/ngalert/notifier/multiorg_alertmanager.go

Co-authored-by: Steve Simpson <steve.simpson@grafana.com>

---------

Co-authored-by: Steve Simpson <steve.simpson@grafana.com>
pull/88369/head^2
Santiago 12 months ago committed by GitHub
parent 35d0597367
commit e15e40fbd3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 2
      pkg/services/ngalert/ngalert.go
  2. 8
      pkg/services/ngalert/notifier/multiorg_alertmanager.go
  3. 1
      pkg/setting/setting_unified_alerting.go

@ -177,6 +177,7 @@ func (ng *AlertNG) init() error {
ng.Log.Debug("Starting Grafana with remote only mode enabled")
m := ng.Metrics.GetRemoteAlertmanagerMetrics()
m.Info.WithLabelValues(metrics.ModeRemoteOnly).Set(1)
ng.Cfg.UnifiedAlerting.SkipClustering = true
// This function will be used by the MOA to create new Alertmanagers.
override := notifier.WithAlertmanagerOverride(func(_ notifier.OrgAlertmanagerFactory) notifier.OrgAlertmanagerFactory {
@ -203,6 +204,7 @@ func (ng *AlertNG) init() error {
case remotePrimary:
ng.Log.Warn("Only remote secondary mode is supported at the moment, falling back to remote secondary")
// TODO: Skip setting up clustering with ng.Cfg.UnifiedAlerting.SkipClustering = true
fallthrough
case remoteSecondary:

@ -142,8 +142,12 @@ func NewMultiOrgAlertmanager(
peer: &NilPeer{},
}
if err := moa.setupClustering(cfg); err != nil {
return nil, err
if cfg.UnifiedAlerting.SkipClustering {
l.Info("Skipping setting up clustering for MOA")
} else {
if err := moa.setupClustering(cfg); err != nil {
return nil, err
}
}
// Set up the default per tenant Alertmanager factory.

@ -98,6 +98,7 @@ type UnifiedAlertingSettings struct {
DefaultRuleEvaluationInterval time.Duration
Screenshots UnifiedAlertingScreenshotSettings
ReservedLabels UnifiedAlertingReservedLabelSettings
SkipClustering bool
StateHistory UnifiedAlertingStateHistorySettings
RemoteAlertmanager RemoteAlertmanagerSettings
// MaxStateSaveConcurrency controls the number of goroutines (per rule) that can save alert state in parallel.

Loading…
Cancel
Save