mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-12-15 00:13:30 +01:00
lib/promscrape/discovery/consul: log the time needed for stoppig Consul service watcher
This commit is contained in:
parent
4e4a93c586
commit
96190f9d45
@ -136,13 +136,14 @@ func (cw *consulWatcher) watchForServicesUpdates() {
|
|||||||
if time.Since(lastAccessTime) > 3*checkInterval {
|
if time.Since(lastAccessTime) > 3*checkInterval {
|
||||||
// The given cw is no longer used. Stop all service watchers and exit.
|
// The given cw is no longer used. Stop all service watchers and exit.
|
||||||
logger.Infof("starting to stop Consul service watchers for %q", clientAddr)
|
logger.Infof("starting to stop Consul service watchers for %q", clientAddr)
|
||||||
|
startTime := time.Now()
|
||||||
cw.servicesLock.Lock()
|
cw.servicesLock.Lock()
|
||||||
for _, sw := range cw.services {
|
for _, sw := range cw.services {
|
||||||
close(sw.stopCh)
|
close(sw.stopCh)
|
||||||
}
|
}
|
||||||
cw.servicesLock.Unlock()
|
cw.servicesLock.Unlock()
|
||||||
cw.wg.Wait()
|
cw.wg.Wait()
|
||||||
logger.Infof("stopped Consul service watcher for %q", clientAddr)
|
logger.Infof("stopped Consul service watcher for %q in %.3f seconds", clientAddr, time.Since(startTime).Seconds())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user