From f87bfdf2ffd3e795a9385f475ba957c7ff4ca16b Mon Sep 17 00:00:00 2001 From: George Robinson Date: Fri, 25 Feb 2022 14:43:08 +0000 Subject: [PATCH] Update comment for scheduler_behind_seconds metric (#45918) --- pkg/services/ngalert/schedule/schedule.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/services/ngalert/schedule/schedule.go b/pkg/services/ngalert/schedule/schedule.go index 8e8c5fd220c..7d607778021 100644 --- a/pkg/services/ngalert/schedule/schedule.go +++ b/pkg/services/ngalert/schedule/schedule.go @@ -369,9 +369,9 @@ func (sch *schedule) schedulePeriodic(ctx context.Context) error { select { case tick := <-sch.ticker.C: // We use Round(0) on the start time to remove the monotonic clock. - // This is required as late ticks from the ticker have current monotonic - // timestamps such that start.Sub(tick) does not return the expected - // delta. + // This is required as ticks from the ticker and time.Now() can have + // a monotonic clock that when subtracted do not represent the delta + // in wall clock time. start := time.Now().Round(0) sch.metrics.BehindSeconds.Set(start.Sub(tick).Seconds())