Alerting: Remove feature toggle for custom recovery threshold (#104455)

This commit is contained in:
Gilles De Mey
2025-04-24 11:58:17 -04:00
committed by GitHub
parent 674fdd1d32
commit 109267ab03
13 changed files with 247 additions and 312 deletions
+1 -1
View File
@@ -161,7 +161,7 @@ func buildCMDNode(rn *rawNode, toggles featuremgmt.FeatureToggles, sqlExpression
case TypeClassicConditions:
node.Command, err = classic.UnmarshalConditionsCmd(rn.Query, rn.RefID)
case TypeThreshold:
node.Command, err = UnmarshalThresholdCommand(rn, toggles)
node.Command, err = UnmarshalThresholdCommand(rn)
case TypeSQL:
node.Command, err = UnmarshalSQLCommand(rn, sqlExpressionCellLimit)
default:
+1 -1
View File
@@ -158,7 +158,7 @@ func (h *ExpressionQueryReader) ReadQuery(
eq.Command = threshold
eq.Properties = q
if firstCondition.UnloadEvaluator != nil && h.features.IsEnabledGlobally(featuremgmt.FlagRecoveryThreshold) {
if firstCondition.UnloadEvaluator != nil {
unloading, err := NewThresholdCommand(common.RefID, referenceVar, firstCondition.UnloadEvaluator.Type, firstCondition.UnloadEvaluator.Params)
unloading.Invert = true
if err != nil {
+2 -3
View File
@@ -13,7 +13,6 @@ import (
"github.com/grafana/grafana/pkg/expr/mathexp"
"github.com/grafana/grafana/pkg/expr/metrics"
"github.com/grafana/grafana/pkg/infra/tracing"
"github.com/grafana/grafana/pkg/services/featuremgmt"
"github.com/grafana/grafana/pkg/util"
)
@@ -131,7 +130,7 @@ type ConditionEvalJSON struct {
}
// UnmarshalResampleCommand creates a ResampleCMD from Grafana's frontend query.
func UnmarshalThresholdCommand(rn *rawNode, features featuremgmt.FeatureToggles) (Command, error) {
func UnmarshalThresholdCommand(rn *rawNode) (Command, error) {
cmdConfig := ThresholdCommandConfig{}
if err := json.Unmarshal(rn.QueryRaw, &cmdConfig); err != nil {
return nil, fmt.Errorf("failed to parse the threshold command: %w", err)
@@ -151,7 +150,7 @@ func UnmarshalThresholdCommand(rn *rawNode, features featuremgmt.FeatureToggles)
if err != nil {
return nil, fmt.Errorf("invalid condition: %w", err)
}
if firstCondition.UnloadEvaluator != nil && features.IsEnabledGlobally(featuremgmt.FlagRecoveryThreshold) {
if firstCondition.UnloadEvaluator != nil {
unloading, err := NewThresholdCommand(rn.RefID, referenceVar, firstCondition.UnloadEvaluator.Type, firstCondition.UnloadEvaluator.Params)
if err != nil {
return nil, fmt.Errorf("invalid unloadCondition: %w", err)
+2 -3
View File
@@ -15,7 +15,6 @@ import (
"github.com/grafana/grafana/pkg/expr/mathexp"
"github.com/grafana/grafana/pkg/infra/tracing"
"github.com/grafana/grafana/pkg/services/featuremgmt"
"github.com/grafana/grafana/pkg/util"
)
@@ -277,7 +276,7 @@ func TestUnmarshalThresholdCommand(t *testing.T) {
QueryRaw: []byte(tc.query),
QueryType: "",
DataSource: nil,
}, featuremgmt.WithFeatures(featuremgmt.FlagRecoveryThreshold))
})
if tc.shouldError {
require.Nil(t, cmd)
@@ -466,7 +465,7 @@ func TestSetLoadedDimensionsToHysteresisCommand(t *testing.T) {
cmd, err := UnmarshalThresholdCommand(&rawNode{
RefID: "B",
QueryRaw: raw,
}, featuremgmt.WithFeatures(featuremgmt.FlagRecoveryThreshold))
})
require.NoError(t, err)
require.Equal(t, fingerprints, cmd.(*HysteresisCommand).LoadedDimensions)