diff --git a/lib/promscrape/config.go b/lib/promscrape/config.go index 21b663719..407c5a13f 100644 --- a/lib/promscrape/config.go +++ b/lib/promscrape/config.go @@ -186,6 +186,12 @@ func (sc *ScrapeConfig) mustStop() { for i := range sc.GCESDConfigs { sc.GCESDConfigs[i].MustStop() } + for i := range sc.DigitaloceanSDConfigs { + sc.DigitaloceanSDConfigs[i].MustStop() + } + for i := range sc.HTTPSDConfigs { + sc.HTTPSDConfigs[i].MustStop() + } } // FileSDConfig represents file-based service discovery config. diff --git a/lib/promscrape/discovery/digitalocean/digitalocean.go b/lib/promscrape/discovery/digitalocean/digitalocean.go index 3c68c2b72..d80c0abf4 100644 --- a/lib/promscrape/discovery/digitalocean/digitalocean.go +++ b/lib/promscrape/discovery/digitalocean/digitalocean.go @@ -146,3 +146,8 @@ func addDropletLabels(droplets []droplet, defaultPort int) []map[string]string { } return ms } + +// MustStop stops further usage for sdc. +func (sdc *SDConfig) MustStop() { + configMap.Delete(sdc) +} diff --git a/lib/promscrape/discovery/http/http.go b/lib/promscrape/discovery/http/http.go index f1b6cee3e..beb85c1a7 100644 --- a/lib/promscrape/discovery/http/http.go +++ b/lib/promscrape/discovery/http/http.go @@ -53,3 +53,8 @@ func addHTTPTargetLabels(src []httpGroupTarget, sourceURL string) []map[string]s } return ms } + +// MustStop stops further usage for sdc. +func (sdc *SDConfig) MustStop() { + configMap.Delete(sdc) +}