lib/promscrape: properly track the number of updated service discovery routines inside Config.mustRestart()

This is a follow-up for d5a599badc
This commit is contained in:
Aliaksandr Valialkin 2023-10-26 00:06:26 +02:00
parent b3bcf99cea
commit af6dc9c963
No known key found for this signature in database
GPG key ID: A72BEC6CD3D0DED1

View file

@ -187,12 +187,13 @@ func (cfg *Config) mustRestart(prevCfg *Config) bool {
}
jobNames := cfg.getJobNames()
tsmGlobal.registerJobNames(jobNames)
hasChanges := started > 0 || stopped > 0 || restarted > 0
if hasChanges {
logger.Infof("updated %d service discovery routines in %.3f seconds, started=%d, stopped=%d, restarted=%d",
len(cfg.ScrapeConfigs), time.Since(startTime).Seconds(), started, stopped, restarted)
updated := started + stopped + restarted
if updated == 0 {
return false
}
return hasChanges
logger.Infof("updated %d service discovery routines in %.3f seconds, started=%d, stopped=%d, restarted=%d",
updated, time.Since(startTime).Seconds(), started, stopped, restarted)
return true
}
func areEqualGlobalConfigs(a, b *GlobalConfig) bool {