Alerting: Feature toggle to disallow sending alerts externally (#87982)

* Define feature toggle

* Implement feature toggle
This commit is contained in:
Steve Simpson
2024-05-23 14:29:19 +02:00
committed by GitHub
parent bd2b248f0e
commit 8421919cb5
11 changed files with 2170 additions and 2036 deletions

View File

@@ -250,10 +250,10 @@ func (ng *AlertNG) init() error {
clk := clock.New()
alertsRouter := sender.NewAlertsRouter(ng.MultiOrgAlertmanager, ng.store, clk, appUrl, ng.Cfg.UnifiedAlerting.DisabledOrgs,
ng.Cfg.UnifiedAlerting.AdminConfigPollInterval, ng.DataSourceService, ng.SecretsService)
ng.Cfg.UnifiedAlerting.AdminConfigPollInterval, ng.DataSourceService, ng.SecretsService, ng.FeatureToggles)
// Make sure we sync at least once as Grafana starts to get the router up and running before we start sending any alerts.
if err := alertsRouter.SyncAndApplyConfigFromDatabase(); err != nil {
if err := alertsRouter.SyncAndApplyConfigFromDatabase(initCtx); err != nil {
return fmt.Errorf("failed to initialize alerting because alert notifications router failed to warm up: %w", err)
}