Alerting: Remove alertingSimplifiedRouting feature toggle (#104980)

Co-authored-by: Gilles De Mey <gilles.de.mey@gmail.com>
This commit is contained in:
Sonia Aguilar
2025-05-09 16:30:56 +03:00
committed by GitHub
co-authored by Gilles De Mey
parent 7345ba35a1
commit 0ceea29787
20 changed files with 87 additions and 164 deletions
-8
View File
@@ -713,14 +713,6 @@ var (
FrontendOnly: true,
Owner: grafanaObservabilityLogsSquad,
},
{
Name: "alertingSimplifiedRouting",
Description: "Enables users to easily configure alert notifications by specifying a contact point directly when editing or creating an alert rule",
Stage: FeatureStageGeneralAvailability,
FrontendOnly: false,
Owner: grafanaAlertingSquad,
Expression: "true", // enabled by default
},
{
Name: "logRowsPopoverMenu",
Description: "Enable filtering menu displayed when text of a log line is selected",
-1
View File
@@ -94,7 +94,6 @@ pdfTables,preview,@grafana/sharing-squad,false,false,false
ssoSettingsApi,GA,@grafana/identity-access-team,false,false,false
canvasPanelPanZoom,preview,@grafana/dataviz-squad,false,false,true
logsInfiniteScrolling,GA,@grafana/observability-logs,false,false,true
alertingSimplifiedRouting,GA,@grafana/alerting-squad,false,false,false
logRowsPopoverMenu,GA,@grafana/observability-logs,false,false,true
pluginsSkipHostEnvVars,experimental,@grafana/plugins-platform-backend,false,false,false
tableSharedCrosshair,experimental,@grafana/dataviz-squad,false,false,true
1 Name Stage Owner requiresDevMode RequiresRestart FrontendOnly
94 ssoSettingsApi GA @grafana/identity-access-team false false false
95 canvasPanelPanZoom preview @grafana/dataviz-squad false false true
96 logsInfiniteScrolling GA @grafana/observability-logs false false true
alertingSimplifiedRouting GA @grafana/alerting-squad false false false
97 logRowsPopoverMenu GA @grafana/observability-logs false false true
98 pluginsSkipHostEnvVars experimental @grafana/plugins-platform-backend false false false
99 tableSharedCrosshair experimental @grafana/dataviz-squad false false true
-4
View File
@@ -387,10 +387,6 @@ const (
// Enables infinite scrolling for the Logs panel in Explore and Dashboards
FlagLogsInfiniteScrolling = "logsInfiniteScrolling"
// FlagAlertingSimplifiedRouting
// Enables users to easily configure alert notifications by specifying a contact point directly when editing or creating an alert rule
FlagAlertingSimplifiedRouting = "alertingSimplifiedRouting"
// FlagLogRowsPopoverMenu
// Enable filtering menu displayed when text of a log line is selected
FlagLogRowsPopoverMenu = "logRowsPopoverMenu"
+3 -2
View File
@@ -356,8 +356,9 @@
{
"metadata": {
"name": "alertingSimplifiedRouting",
"resourceVersion": "1743693517832",
"creationTimestamp": "2023-11-10T13:14:39Z"
"resourceVersion": "1745491786560",
"creationTimestamp": "2023-11-10T13:14:39Z",
"deletionTimestamp": "2025-05-06T07:23:50Z"
},
"spec": {
"description": "Enables users to easily configure alert notifications by specifying a contact point directly when editing or creating an alert rule",
@@ -610,7 +610,7 @@ func createMultiOrgAlertmanager(t *testing.T, configs map[int64]*ngmodels.AlertC
ngfakes.NewFakeReceiverPermissionsService(),
log.New("testlogger"),
secretsService,
featuremgmt.WithManager(featuremgmt.FlagAlertingSimplifiedRouting),
featuremgmt.WithManager(),
)
require.NoError(t, err)
err = mam.LoadAndSyncAlertmanagersForOrgs(context.Background())
+1 -1
View File
@@ -582,7 +582,7 @@ func (srv RulerSrv) updateAlertRulesInGroup(c *contextmodel.ReqContext, groupKey
return ErrResp(http.StatusInternalServerError, err, "failed to update rule group")
}
if srv.featureManager.IsEnabled(c.Req.Context(), featuremgmt.FlagAlertingSimplifiedRouting) && dbConfig != nil {
if dbConfig != nil {
// This isn't strictly necessary since the alertmanager config is periodically synced.
err := srv.amRefresher.ApplyConfig(c.Req.Context(), groupKey.OrgID, dbConfig)
if err != nil {
+2 -5
View File
@@ -189,11 +189,8 @@ func (ng *AlertNG) init() error {
remotePrimary := ng.FeatureToggles.IsEnabled(initCtx, featuremgmt.FlagAlertmanagerRemotePrimary)
remoteSecondary := ng.FeatureToggles.IsEnabled(initCtx, featuremgmt.FlagAlertmanagerRemoteSecondary)
if remoteOnly || remotePrimary || remoteSecondary {
autogenFn := remote.NoopAutogenFn
if ng.FeatureToggles.IsEnabled(initCtx, featuremgmt.FlagAlertingSimplifiedRouting) {
autogenFn = func(ctx context.Context, logger log.Logger, orgID int64, cfg *definitions.PostableApiAlertingConfig, skipInvalid bool) error {
return notifier.AddAutogenConfig(ctx, logger, ng.store, orgID, cfg, skipInvalid)
}
autogenFn := func(ctx context.Context, logger log.Logger, orgID int64, cfg *definitions.PostableApiAlertingConfig, skipInvalid bool) error {
return notifier.AddAutogenConfig(ctx, logger, ng.store, orgID, cfg, skipInvalid)
}
switch {
+3 -10
View File
@@ -60,8 +60,6 @@ type alertmanager struct {
decryptFn alertingNotify.GetDecryptedValueFn
orgID int64
withAutogen bool
}
// maintenanceOptions represent the options for components that need maintenance on a frequency within the Alertmanager.
@@ -152,9 +150,6 @@ func NewAlertmanager(ctx context.Context, orgID int64, cfg *setting.Cfg, store A
decryptFn: decryptFn,
stateStore: stateStore,
logger: l,
// TODO: Preferably, logic around autogen would be outside of the specific alertmanager implementation so that remote alertmanager will get it for free.
withAutogen: featureToggles.IsEnabled(ctx, featuremgmt.FlagAlertingSimplifiedRouting),
}
return am, nil
@@ -322,11 +317,9 @@ func (am *alertmanager) aggregateInhibitMatchers(rules []config.InhibitRule, amu
// It returns a boolean indicating whether the user config was changed and an error.
// It is not safe to call concurrently.
func (am *alertmanager) applyConfig(ctx context.Context, cfg *apimodels.PostableUserConfig, skipInvalid bool) (bool, error) {
if am.withAutogen {
err := AddAutogenConfig(ctx, am.logger, am.Store, am.orgID, &cfg.AlertmanagerConfig, skipInvalid)
if err != nil {
return false, err
}
err := AddAutogenConfig(ctx, am.logger, am.Store, am.orgID, &cfg.AlertmanagerConfig, skipInvalid)
if err != nil {
return false, err
}
// First, let's make sure this config is not already loaded
@@ -11,7 +11,6 @@ import (
"k8s.io/apimachinery/pkg/util/sets"
"github.com/grafana/grafana/pkg/apimachinery/errutil"
"github.com/grafana/grafana/pkg/services/featuremgmt"
"github.com/grafana/grafana/pkg/services/ngalert/api/tooling/definitions"
"github.com/grafana/grafana/pkg/services/ngalert/models"
"github.com/grafana/grafana/pkg/services/ngalert/notifier/legacy_storage"
@@ -122,7 +121,7 @@ func (moa *MultiOrgAlertmanager) GetAlertmanagerConfiguration(ctx context.Contex
return definitions.GettableUserConfig{}, err
}
if moa.featureManager.IsEnabled(ctx, featuremgmt.FlagAlertingSimplifiedRouting) && withAutogen {
if withAutogen {
// We validate the notification settings in a similar way to when we POST.
// Otherwise, broken settings (e.g. a receiver that doesn't exist) will cause the config returned here to be
// different than the config currently in-use.
+1 -1
View File
@@ -4371,7 +4371,7 @@ func TestIntegrationRuleNotificationSettings(t *testing.T) {
DisableAnonymous: true,
AppModeProduction: true,
NGAlertSchedulerBaseInterval: 1 * time.Second,
EnableFeatureToggles: []string{featuremgmt.FlagConfigurableSchedulerTick, featuremgmt.FlagAlertingSimplifiedRouting},
EnableFeatureToggles: []string{featuremgmt.FlagConfigurableSchedulerTick},
})
grafanaListedAddr, env := testinfra.StartGrafanaEnv(t, dir, p)