Alerting: new min_interval_seconds options to enforce a minimum eval frequency (#21188)

* add min_interval_seconds setting to alerting config

It will let operator enforce a minimum time for the scheduler to enqueue evaluations

* Introduce UI modifications

* Update docs

Co-authored-by: Martin <uepoch@users.noreply.github.com>
This commit is contained in:
Sofia Papagiannaki
2020-01-14 11:13:34 +02:00
committed by GitHub
co-authored by Martin
parent 6b3041d358
commit d135f1229d
10 changed files with 56 additions and 2 deletions
+8 -1
View File
@@ -6,6 +6,7 @@ import (
"github.com/grafana/grafana/pkg/infra/log"
"github.com/grafana/grafana/pkg/models"
"github.com/grafana/grafana/pkg/setting"
)
type schedulerImpl struct {
@@ -61,7 +62,13 @@ func (s *schedulerImpl) Tick(tickTime time.Time, execQueue chan *Job) {
continue
}
if now%job.Rule.Frequency == 0 {
// Check the job frequency against the minimum interval required
interval := job.Rule.Frequency
if interval < setting.AlertingMinInterval {
interval = setting.AlertingMinInterval
}
if now%interval == 0 {
if job.Offset > 0 {
job.OffsetWait = true
} else {