Alerting: Add alertingOptimizeReducerInUI feature toggle (#96608)
add alertingOptimizeReducerInUI feature toggle
This commit is contained in:
@@ -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
|
||||
|
||||
|
@@ -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",
|
||||
|
||||
+3
-2
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user