Rename remaining jitterSeed -> offsetSeed variables (#12414)

I had changed the naming from "jitter" to "offset" in:

cb045c0e4b

...but I forgot to add this file to the commit to complete the renaming,
doing that now.

Signed-off-by: Julius Volz <julius.volz@gmail.com>
pull/12446/head
Julius Volz 1 year ago committed by GitHub
parent b1675e23af
commit ac8abdaacd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -154,14 +154,14 @@ func (t *Target) hash() uint64 {
}
// offset returns the time until the next scrape cycle for the target.
// It includes the global server jitterSeed for scrapes from multiple Prometheus to try to be at different times.
func (t *Target) offset(interval time.Duration, jitterSeed uint64) time.Duration {
// It includes the global server offsetSeed for scrapes from multiple Prometheus to try to be at different times.
func (t *Target) offset(interval time.Duration, offsetSeed uint64) time.Duration {
now := time.Now().UnixNano()
// Base is a pinned to absolute time, no matter how often offset is called.
var (
base = int64(interval) - now%int64(interval)
offset = (t.hash() ^ jitterSeed) % uint64(interval)
offset = (t.hash() ^ offsetSeed) % uint64(interval)
next = base + int64(offset)
)

Loading…
Cancel
Save