The config map was never reset on applying a new config

This commit is contained in:
Krasi Georgiev 2018-01-14 19:41:53 +00:00
parent febebcd49a
commit a981b51900

View file

@ -83,9 +83,11 @@ func (m *ScrapeManager) Stop() {
func (m *ScrapeManager) ApplyConfig(cfg *config.Config) error { func (m *ScrapeManager) ApplyConfig(cfg *config.Config) error {
done := make(chan struct{}) done := make(chan struct{})
m.actionCh <- func() { m.actionCh <- func() {
c := make(map[string]*config.ScrapeConfig)
for _, scfg := range cfg.ScrapeConfigs { for _, scfg := range cfg.ScrapeConfigs {
m.scrapeConfigs[scfg.JobName] = scfg c[scfg.JobName] = scfg
} }
m.scrapeConfigs = c
close(done) close(done)
} }
<-done <-done