mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
vmagent: update SD duration histogram metric if SD is active (#2677)
The change updates histogram for registering SD update duration only SD is considered as `active`. SD is active if at least one scraper for this SD has started. This change supposed to reduce metrics cardinality produced by duration histogram which gets updated even if SD isn't configured. See https://github.com/VictoriaMetrics/VictoriaMetrics/issues/2671 Signed-off-by: hagen1778 <roman@victoriametrics.com>
This commit is contained in:
parent
d830f43608
commit
2b5e1dee91
1 changed files with 5 additions and 1 deletions
|
@ -256,7 +256,11 @@ func (scfg *scrapeConfig) run(globalStopCh <-chan struct{}) {
|
|||
sws := scfg.getScrapeWork(cfg, swsPrev)
|
||||
sg.update(sws)
|
||||
swsPrev = sws
|
||||
scfg.discoveryDuration.UpdateDuration(startTime)
|
||||
if sg.scrapersStarted.Get() > 0 {
|
||||
// update duration only if at least one scraper has started
|
||||
// otherwise this SD is considered as inactive
|
||||
scfg.discoveryDuration.UpdateDuration(startTime)
|
||||
}
|
||||
}
|
||||
updateScrapeWork(cfg)
|
||||
atomic.AddInt32(&PendingScrapeConfigs, -1)
|
||||
|
|
Loading…
Reference in a new issue