mirror of
https://github.com/prometheus/prometheus
synced 2024-12-24 23:42:32 +00:00
Simplify logic
Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
This commit is contained in:
parent
ccc1df3140
commit
b90c7a55da
@ -990,8 +990,8 @@ func (sl *scrapeLoop) run(interval, timeout time.Duration, errc chan<- error) {
|
|||||||
|
|
||||||
var last time.Time
|
var last time.Time
|
||||||
|
|
||||||
ticker := time.NewTicker(interval)
|
|
||||||
alignedScrapeTime := time.Now()
|
alignedScrapeTime := time.Now()
|
||||||
|
ticker := time.NewTicker(interval)
|
||||||
defer ticker.Stop()
|
defer ticker.Stop()
|
||||||
|
|
||||||
mainLoop:
|
mainLoop:
|
||||||
@ -1016,7 +1016,7 @@ mainLoop:
|
|||||||
alignedScrapeTime = alignedScrapeTime.Add(interval)
|
alignedScrapeTime = alignedScrapeTime.Add(interval)
|
||||||
}
|
}
|
||||||
// Align the scrape time if we are in the tolerance boundaries.
|
// Align the scrape time if we are in the tolerance boundaries.
|
||||||
if t := scrapeTime.Sub(alignedScrapeTime); t >= -scrapeTimestampTolerance && t <= scrapeTimestampTolerance {
|
if scrapeTime.Sub(alignedScrapeTime) <= scrapeTimestampTolerance {
|
||||||
scrapeTime = alignedScrapeTime
|
scrapeTime = alignedScrapeTime
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user