mirror of
https://github.com/grafana/grafana.git
synced 2025-09-26 22:23:44 +08:00
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>
This commit is contained in:
@ -177,6 +177,7 @@ func (ng *AlertNG) init() error {
|
|||||||
ng.Log.Debug("Starting Grafana with remote only mode enabled")
|
ng.Log.Debug("Starting Grafana with remote only mode enabled")
|
||||||
m := ng.Metrics.GetRemoteAlertmanagerMetrics()
|
m := ng.Metrics.GetRemoteAlertmanagerMetrics()
|
||||||
m.Info.WithLabelValues(metrics.ModeRemoteOnly).Set(1)
|
m.Info.WithLabelValues(metrics.ModeRemoteOnly).Set(1)
|
||||||
|
ng.Cfg.UnifiedAlerting.SkipClustering = true
|
||||||
|
|
||||||
// This function will be used by the MOA to create new Alertmanagers.
|
// This function will be used by the MOA to create new Alertmanagers.
|
||||||
override := notifier.WithAlertmanagerOverride(func(_ notifier.OrgAlertmanagerFactory) notifier.OrgAlertmanagerFactory {
|
override := notifier.WithAlertmanagerOverride(func(_ notifier.OrgAlertmanagerFactory) notifier.OrgAlertmanagerFactory {
|
||||||
@ -203,6 +204,7 @@ func (ng *AlertNG) init() error {
|
|||||||
|
|
||||||
case remotePrimary:
|
case remotePrimary:
|
||||||
ng.Log.Warn("Only remote secondary mode is supported at the moment, falling back to remote secondary")
|
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
|
fallthrough
|
||||||
|
|
||||||
case remoteSecondary:
|
case remoteSecondary:
|
||||||
|
@ -142,9 +142,13 @@ func NewMultiOrgAlertmanager(
|
|||||||
peer: &NilPeer{},
|
peer: &NilPeer{},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if cfg.UnifiedAlerting.SkipClustering {
|
||||||
|
l.Info("Skipping setting up clustering for MOA")
|
||||||
|
} else {
|
||||||
if err := moa.setupClustering(cfg); err != nil {
|
if err := moa.setupClustering(cfg); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Set up the default per tenant Alertmanager factory.
|
// Set up the default per tenant Alertmanager factory.
|
||||||
moa.factory = func(ctx context.Context, orgID int64) (Alertmanager, error) {
|
moa.factory = func(ctx context.Context, orgID int64) (Alertmanager, error) {
|
||||||
|
@ -98,6 +98,7 @@ type UnifiedAlertingSettings struct {
|
|||||||
DefaultRuleEvaluationInterval time.Duration
|
DefaultRuleEvaluationInterval time.Duration
|
||||||
Screenshots UnifiedAlertingScreenshotSettings
|
Screenshots UnifiedAlertingScreenshotSettings
|
||||||
ReservedLabels UnifiedAlertingReservedLabelSettings
|
ReservedLabels UnifiedAlertingReservedLabelSettings
|
||||||
|
SkipClustering bool
|
||||||
StateHistory UnifiedAlertingStateHistorySettings
|
StateHistory UnifiedAlertingStateHistorySettings
|
||||||
RemoteAlertmanager RemoteAlertmanagerSettings
|
RemoteAlertmanager RemoteAlertmanagerSettings
|
||||||
// MaxStateSaveConcurrency controls the number of goroutines (per rule) that can save alert state in parallel.
|
// MaxStateSaveConcurrency controls the number of goroutines (per rule) that can save alert state in parallel.
|
||||||
|
Reference in New Issue
Block a user