Alerting: Add alertingOptimizeReducerInUI feature toggle (#96608)

add alertingOptimizeReducerInUI feature toggle
pull/96621/head
Sonia Aguilar 1 year ago committed by GitHub
parent d187716e73
commit 76444c7913
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 1
      docs/sources/setup-grafana/configure-grafana/feature-toggles/index.md
  2. 1
      packages/grafana-data/src/types/featureToggles.gen.ts
  3. 8
      pkg/services/featuremgmt/registry.go
  4. 1
      pkg/services/featuremgmt/toggles_gen.csv
  5. 4
      pkg/services/featuremgmt/toggles_gen.go
  6. 17
      pkg/services/featuremgmt/toggles_gen.json
  7. 5
      public/app/features/alerting/unified/components/rule-editor/query-and-alert-condition/QueryAndExpressionsStep.tsx

@ -80,6 +80,7 @@ Most [generally available](https://grafana.com/docs/release-life-cycle/#general-
| `cloudwatchMetricInsightsCrossAccount` | Enables cross account observability for Cloudwatch Metric Insights query builder | Yes |
| `azureMonitorDisableLogLimit` | Disables the log limit restriction for Azure Monitor when true. The limit is enabled by default. | |
| `preinstallAutoUpdate` | Enables automatic updates for pre-installed plugins | Yes |
| `alertingUIOptimizeReducer` | Enables removing the reducer from the alerting UI when creating a new alert rule and using instant query | Yes |
## Public preview feature toggles

@ -239,4 +239,5 @@ export interface FeatureToggles {
crashDetection?: boolean;
jaegerBackendMigration?: boolean;
reportingUseRawTimeRange?: boolean;
alertingUIOptimizeReducer?: boolean;
}

@ -1650,6 +1650,14 @@ var (
Owner: grafanaSharingSquad,
Expression: "false", // disabled by default
},
{
Name: "alertingUIOptimizeReducer",
Description: "Enables removing the reducer from the alerting UI when creating a new alert rule and using instant query",
Stage: FeatureStageGeneralAvailability,
FrontendOnly: true,
Owner: grafanaAlertingSquad,
Expression: "true", // enabled by default
},
}
)

@ -220,3 +220,4 @@ enableSCIM,experimental,@grafana/identity-access-team,false,false,false
crashDetection,experimental,@grafana/observability-traces-and-profiling,false,false,true
jaegerBackendMigration,experimental,@grafana/oss-big-tent,false,false,false
reportingUseRawTimeRange,preview,@grafana/sharing-squad,false,false,false
alertingUIOptimizeReducer,GA,@grafana/alerting-squad,false,false,true

1 Name Stage Owner requiresDevMode RequiresRestart FrontendOnly
220 crashDetection experimental @grafana/observability-traces-and-profiling false false true
221 jaegerBackendMigration experimental @grafana/oss-big-tent false false false
222 reportingUseRawTimeRange preview @grafana/sharing-squad false false false
223 alertingUIOptimizeReducer GA @grafana/alerting-squad false false true

@ -890,4 +890,8 @@ const (
// FlagReportingUseRawTimeRange
// Uses the original report or dashboard time range instead of making an absolute transformation
FlagReportingUseRawTimeRange = "reportingUseRawTimeRange"
// FlagAlertingUIOptimizeReducer
// Enables removing the reducer from the alerting UI when creating a new alert rule and using instant query
FlagAlertingUIOptimizeReducer = "alertingUIOptimizeReducer"
)

@ -314,6 +314,23 @@
"expression": "true"
}
},
{
"metadata": {
"name": "alertingUIOptimizeReducer",
"resourceVersion": "1731923458730",
"creationTimestamp": "2024-11-18T09:06:02Z",
"annotations": {
"grafana.app/updatedTimestamp": "2024-11-18 09:50:58.730825 +0000 UTC"
}
},
"spec": {
"description": "Enables removing the reducer from the alerting UI when creating a new alert rule and using instant query",
"stage": "GA",
"codeowner": "@grafana/alerting-squad",
"frontend": true,
"expression": "true"
}
},
{
"metadata": {
"name": "alertmanagerRemoteOnly",

@ -265,6 +265,7 @@ export const QueryAndExpressionsStep = ({ editingExistingRule, onDataChange }: P
);
const updateExpressionAndDatasource = useSetExpressionAndDataSource();
const isOptimizeReducerEnabled = config.featureToggles.alertingUIOptimizeReducer ?? false;
const onChangeQueries = useCallback(
(updatedQueries: AlertQuery[]) => {
@ -280,7 +281,7 @@ export const QueryAndExpressionsStep = ({ editingExistingRule, onDataChange }: P
// we only remove or add the reducer(optimize reducer) expression when creating a new alert.
// When editing an alert, we assume the user wants to manually adjust expressions and queries for more control and customization.
if (!editingExistingRule) {
if (!editingExistingRule && isOptimizeReducerEnabled) {
dispatch(optimizeReduceExpression({ updatedQueries, expressionQueries }));
}
@ -293,7 +294,7 @@ export const QueryAndExpressionsStep = ({ editingExistingRule, onDataChange }: P
dispatch(rewireExpressions({ oldRefId, newRefId }));
}
},
[queries, updateExpressionAndDatasource, getValues, setValue, editingExistingRule]
[queries, updateExpressionAndDatasource, getValues, setValue, editingExistingRule, isOptimizeReducerEnabled]
);
const onChangeRecordingRulesQueries = useCallback(

Loading…
Cancel
Save