mirror of
https://github.com/prometheus/prometheus.git
synced 2024-11-09 23:24:05 -08:00
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>
This commit is contained in:
parent
b1675e23af
commit
ac8abdaacd
|
@ -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…
Reference in a new issue