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>
pull/4959/head
F4ncyMooN 6 years ago committed by Brian Brazil
parent 135d580ab2
commit cd491e2d3a

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

Loading…
Cancel
Save