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:
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…
Reference in New Issue