From cd491e2d3a4dd225ea352a0a98cc3343c204528e Mon Sep 17 00:00:00 2001 From: F4ncyMooN Date: Wed, 5 Dec 2018 17:58:39 +0800 Subject: [PATCH] wait for interval-now%interval to make sure target will be collected with a fixed interval when restart prometheus (#4926) Signed-off-by: hlv --- scrape/target.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scrape/target.go b/scrape/target.go index 3502dcf9c8..d136e6fff5 100644 --- a/scrape/target.go +++ b/scrape/target.go @@ -129,7 +129,7 @@ func (t *Target) offset(interval time.Duration) time.Duration { now := time.Now().UnixNano() var ( - base = now % int64(interval) + base = int64(interval) - now%int64(interval) offset = t.hash() % uint64(interval) next = base + int64(offset) )