mirror of
https://github.com/prometheus/prometheus
synced 2024-12-27 17:13:22 +00:00
Fix scrape interval length calculation
This commit is contained in:
parent
1a3253e8ed
commit
fbe251c2df
@ -235,9 +235,12 @@ func (sl *scrapeLoop) run(interval, timeout time.Duration, errc chan<- error) {
|
||||
scrapeCtx, _ = context.WithTimeout(sl.ctx, timeout)
|
||||
)
|
||||
|
||||
targetIntervalLength.WithLabelValues(interval.String()).Observe(
|
||||
float64(time.Since(last)) / float64(time.Second), // Sub-second precision.
|
||||
)
|
||||
// Only record after the first scrape.
|
||||
if !last.IsZero() {
|
||||
targetIntervalLength.WithLabelValues(interval.String()).Observe(
|
||||
float64(time.Since(last)) / float64(time.Second), // Sub-second precision.
|
||||
)
|
||||
}
|
||||
|
||||
samples, err := sl.scraper.scrape(scrapeCtx, start)
|
||||
if err == nil {
|
||||
|
Loading…
Reference in New Issue
Block a user