wait for interval-now%interval to make sure target will be collected with a fixed interval when restart prometheus (#4926)

Signed-off-by: hlv <hlv@freewheel.tv>
This commit is contained in:
F4ncyMooN 2018-12-05 17:58:39 +08:00 committed by Brian Brazil
parent 135d580ab2
commit cd491e2d3a
1 changed files with 1 additions and 1 deletions

View File

@ -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)
)