mirror of
https://github.com/prometheus/prometheus.git
synced 2025-03-05 20:59:13 -08:00
retrieval: fix missing scrape context cancellation (#2599)
This commit is contained in:
parent
0c3462762b
commit
f160f17a6f
|
@ -413,7 +413,7 @@ func (sl *scrapeLoop) run(interval, timeout time.Duration, errc chan<- error) {
|
||||||
if !sl.appender.NeedsThrottling() {
|
if !sl.appender.NeedsThrottling() {
|
||||||
var (
|
var (
|
||||||
start = time.Now()
|
start = time.Now()
|
||||||
scrapeCtx, _ = context.WithTimeout(sl.ctx, timeout)
|
scrapeCtx, cancel = context.WithTimeout(sl.ctx, timeout)
|
||||||
numPostRelabelSamples = 0
|
numPostRelabelSamples = 0
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -425,6 +425,7 @@ func (sl *scrapeLoop) run(interval, timeout time.Duration, errc chan<- error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
samples, err := sl.scraper.scrape(scrapeCtx, start)
|
samples, err := sl.scraper.scrape(scrapeCtx, start)
|
||||||
|
cancel()
|
||||||
if err == nil {
|
if err == nil {
|
||||||
numPostRelabelSamples, err = sl.append(samples)
|
numPostRelabelSamples, err = sl.append(samples)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue