lib/promscrape: properly reload new configs on SIGHUP

This commit is contained in:
Aliaksandr Valialkin 2020-02-26 13:45:13 +02:00
parent fa6815712f
commit e6a481ab11

View file

@ -89,12 +89,12 @@ func runScraper(configFile string, pushData func(wr *prompbmarshal.WriteRequest)
logger.Errorf("cannot read %q: %s; continuing with the previous config", configFile, err) logger.Errorf("cannot read %q: %s; continuing with the previous config", configFile, err)
goto waitForChans goto waitForChans
} }
swsStaticNew, err := cfg.getStaticScrapeWork() swsStaticNew, err := cfgNew.getStaticScrapeWork()
if err != nil { if err != nil {
logger.Errorf("cannot parse `static_configs` from %q: %s; continuing with the previous config", configFile, err) logger.Errorf("cannot parse `static_configs` from %q: %s; continuing with the previous config", configFile, err)
goto waitForChans goto waitForChans
} }
swsFileSDNew, err := cfg.getFileSDScrapeWork(swsFileSD) swsFileSDNew, err := cfgNew.getFileSDScrapeWork(swsFileSD)
if err != nil { if err != nil {
logger.Errorf("cannot parse `file_sd_config` from %q: %s; continuing with the previous config", configFile, err) logger.Errorf("cannot parse `file_sd_config` from %q: %s; continuing with the previous config", configFile, err)
} }