Alerting: Nilcheck JitterStrategyFrom so it can be used in contexts without feature toggles (#80841)

Nilcheck so tests can have a nil feature toggles
This commit is contained in:
Alexander Weaver 2024-01-18 15:43:41 -06:00 committed by GitHub
parent f285eb6717
commit 18b9c8fd5f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -21,6 +21,9 @@ const (
// JitterStrategyFrom returns the JitterStrategy indicated by the current Grafana feature toggles.
func JitterStrategyFrom(toggles featuremgmt.FeatureToggles) JitterStrategy {
strategy := JitterNever
if toggles == nil {
return strategy
}
if toggles.IsEnabledGlobally(featuremgmt.FlagJitterAlertRules) {
strategy = JitterByGroup
}