Reduce lock-protected area during scrape.
Change-Id: Iaa7faa7c916b1890b568d05bd8bfff6299b6767d
This commit is contained in:
parent
fee88a7a77
commit
89bb376bce
|
@ -297,15 +297,14 @@ func (t *target) scrape(ingester extraction.Ingester) (err error) {
|
|||
t.Lock() // Writing t.state and t.lastError requires the lock.
|
||||
if err == nil {
|
||||
t.state = ALIVE
|
||||
t.recordScrapeHealth(ingester, timestamp, true)
|
||||
labels[outcome] = failure
|
||||
} else {
|
||||
t.state = UNREACHABLE
|
||||
t.recordScrapeHealth(ingester, timestamp, false)
|
||||
}
|
||||
targetOperationLatencies.With(labels).Observe(ms)
|
||||
t.lastError = err
|
||||
t.Unlock()
|
||||
targetOperationLatencies.With(labels).Observe(ms)
|
||||
t.recordScrapeHealth(ingester, timestamp, err == nil)
|
||||
}(time.Now())
|
||||
|
||||
req, err := http.NewRequest("GET", t.Address(), nil)
|
||||
|
|
Loading…
Reference in New Issue