diff --git a/app/vmalert/alerting.go b/app/vmalert/alerting.go index 0f819cbd64..64a86bbea6 100644 --- a/app/vmalert/alerting.go +++ b/app/vmalert/alerting.go @@ -323,7 +323,7 @@ func (ar *AlertingRule) Exec(ctx context.Context, ts time.Time) ([]prompbmarshal } continue } - if a.State == notifier.StatePending && time.Since(a.ActiveAt) >= ar.For { + if a.State == notifier.StatePending && ts.Sub(a.ActiveAt) >= ar.For { a.State = notifier.StateFiring a.Start = ts alertsFired.Inc() diff --git a/app/vmalert/group.go b/app/vmalert/group.go index e218e4fc75..d89f5037c3 100644 --- a/app/vmalert/group.go +++ b/app/vmalert/group.go @@ -237,8 +237,6 @@ func (g *Group) start(ctx context.Context, nts func() []notifier.Notifier, rw *r notifiers: nts, previouslySentSeriesToRW: make(map[uint64]map[string][]prompbmarshal.Label)} - evalTS := time.Now() - // Spread group rules evaluation over time in order to reduce load on VictoriaMetrics. if !skipRandSleepOnGroupStart { randSleep := uint64(float64(g.Interval) * (float64(g.ID()) / (1 << 64))) @@ -259,6 +257,8 @@ func (g *Group) start(ctx context.Context, nts func() []notifier.Notifier, rw *r } } + evalTS := time.Now() + logger.Infof("group %q started; interval=%v; concurrency=%d", g.Name, g.Interval, g.Concurrency) eval := func(ts time.Time) {