Alerting: Remove grafanaManagedRecordingRules feature flag (#105569)
This commit is contained in:
@@ -23,15 +23,12 @@ type RuleLimits struct {
|
||||
DefaultRuleEvaluationInterval time.Duration
|
||||
// All intervals must be an integer multiple of this duration.
|
||||
BaseInterval time.Duration
|
||||
// Whether recording rules are allowed.
|
||||
RecordingRulesAllowed bool
|
||||
}
|
||||
|
||||
func RuleLimitsFromConfig(cfg *setting.UnifiedAlertingSettings, toggles featuremgmt.FeatureToggles) RuleLimits {
|
||||
return RuleLimits{
|
||||
DefaultRuleEvaluationInterval: cfg.DefaultRuleEvaluationInterval,
|
||||
BaseInterval: cfg.BaseInterval,
|
||||
RecordingRulesAllowed: toggles.IsEnabledGlobally(featuremgmt.FlagGrafanaManagedRecordingRules),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -176,10 +173,6 @@ func validateAlertingRuleFields(in *apimodels.PostableExtendedRuleNode, newRule
|
||||
// validateRecordingRuleFields validates only the fields on a rule that are specific to Recording rules.
|
||||
// it will load fields that pass validation onto newRule and return the result.
|
||||
func validateRecordingRuleFields(in *apimodels.PostableExtendedRuleNode, newRule ngmodels.AlertRule, limits RuleLimits, canPatch bool) (ngmodels.AlertRule, error) {
|
||||
if !limits.RecordingRulesAllowed {
|
||||
return ngmodels.AlertRule{}, fmt.Errorf("%w: recording rules cannot be created on this instance", ngmodels.ErrAlertRuleFailedValidation)
|
||||
}
|
||||
|
||||
err := ValidateCondition(in.GrafanaManagedAlert.Record.From, in.GrafanaManagedAlert.Data, canPatch)
|
||||
if err != nil {
|
||||
return ngmodels.AlertRule{}, fmt.Errorf("%w: %s", ngmodels.ErrAlertRuleFailedValidation, err.Error())
|
||||
|
||||
Reference in New Issue
Block a user