Alerting: Add setting to distribute rule group evaluations over time (#80766)
* Simple, per-base-interval jitter * Add log just for test purposes * Add strategy approach, allow choosing between group or rule * Add flag to jitter rules * Add second toggle for jittering within a group * Wire up toggles to strategy * Slightly improve comment ordering * Add tests for offset generation * Rename JitterStrategyFrom * Improve debug log message * Use grafana SDK labels rather than prometheus labels
This commit is contained in:
@@ -186,6 +186,12 @@ func WithInterval(interval time.Duration) AlertRuleMutator {
|
||||
}
|
||||
}
|
||||
|
||||
func WithIntervalBetween(min, max int64) AlertRuleMutator {
|
||||
return func(rule *AlertRule) {
|
||||
rule.IntervalSeconds = rand.Int63n(max-min) + min
|
||||
}
|
||||
}
|
||||
|
||||
func WithTitle(title string) AlertRuleMutator {
|
||||
return func(rule *AlertRule) {
|
||||
rule.Title = title
|
||||
|
||||
Reference in New Issue
Block a user