mirror of
https://github.com/prometheus/prometheus.git
synced 2025-01-11 22:07:27 -08:00
[BUGFIX] Scraping: Tolerance should be max 1% of interval
Previous code set it at minimum 1%, which was not intended. Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
This commit is contained in:
parent
9acae57937
commit
6c41ec984f
|
@ -1218,10 +1218,8 @@ mainLoop:
|
||||||
// and .Add on time.Time behave differently (see time package docs).
|
// and .Add on time.Time behave differently (see time package docs).
|
||||||
scrapeTime := time.Now().Round(0)
|
scrapeTime := time.Now().Round(0)
|
||||||
if AlignScrapeTimestamps {
|
if AlignScrapeTimestamps {
|
||||||
tolerance := ScrapeTimestampTolerance
|
// Tolerance is clamped to maximum 1% of the scrape interval.
|
||||||
if maxTolerance := sl.interval / 100; tolerance < maxTolerance {
|
tolerance := min(sl.interval/100, ScrapeTimestampTolerance)
|
||||||
tolerance = maxTolerance
|
|
||||||
}
|
|
||||||
// For some reason, a tick might have been skipped, in which case we
|
// For some reason, a tick might have been skipped, in which case we
|
||||||
// would call alignedScrapeTime.Add(interval) multiple times.
|
// would call alignedScrapeTime.Add(interval) multiple times.
|
||||||
for scrapeTime.Sub(alignedScrapeTime) >= sl.interval {
|
for scrapeTime.Sub(alignedScrapeTime) >= sl.interval {
|
||||||
|
|
Loading…
Reference in a new issue