From de0643fab51e81d6e6767e0239e7b7aefe36fd51 Mon Sep 17 00:00:00 2001 From: Aliaksandr Valialkin Date: Thu, 3 Dec 2020 20:14:17 +0200 Subject: [PATCH] lib/promscrape/discovery/consul: log the time needed for stoppig Consul service watcher --- lib/promscrape/discovery/consul/watch.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/promscrape/discovery/consul/watch.go b/lib/promscrape/discovery/consul/watch.go index 533b3edbc..b56da1d79 100644 --- a/lib/promscrape/discovery/consul/watch.go +++ b/lib/promscrape/discovery/consul/watch.go @@ -136,13 +136,14 @@ func (cw *consulWatcher) watchForServicesUpdates() { if time.Since(lastAccessTime) > 3*checkInterval { // The given cw is no longer used. Stop all service watchers and exit. logger.Infof("starting to stop Consul service watchers for %q", clientAddr) + startTime := time.Now() cw.servicesLock.Lock() for _, sw := range cw.services { close(sw.stopCh) } cw.servicesLock.Unlock() 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 }