mirror of
https://github.com/prometheus/prometheus.git
synced 2025-02-02 08:31:11 -08:00
refactor the config reloading execution
This commit is contained in:
parent
af58c1b452
commit
97f0461e29
|
@ -287,6 +287,9 @@ func main() {
|
||||||
remoteStorage.ApplyConfig,
|
remoteStorage.ApplyConfig,
|
||||||
webHandler.ApplyConfig,
|
webHandler.ApplyConfig,
|
||||||
notifier.ApplyConfig,
|
notifier.ApplyConfig,
|
||||||
|
// The Scrape manager needs to reload before the Discvoery manager as
|
||||||
|
// it needs to read the latest config when it receives the new targets list.
|
||||||
|
scrapeManager.ApplyConfig,
|
||||||
func(cfg *config.Config) error {
|
func(cfg *config.Config) error {
|
||||||
c := make(map[string]sd_config.ServiceDiscoveryConfig)
|
c := make(map[string]sd_config.ServiceDiscoveryConfig)
|
||||||
for _, v := range cfg.ScrapeConfigs {
|
for _, v := range cfg.ScrapeConfigs {
|
||||||
|
@ -306,7 +309,6 @@ func main() {
|
||||||
}
|
}
|
||||||
return discoveryManagerNotify.ApplyConfig(c)
|
return discoveryManagerNotify.ApplyConfig(c)
|
||||||
},
|
},
|
||||||
scrapeManager.ApplyConfig,
|
|
||||||
func(cfg *config.Config) error {
|
func(cfg *config.Config) error {
|
||||||
// Get all rule files matching the configuration oaths.
|
// Get all rule files matching the configuration oaths.
|
||||||
var files []string
|
var files []string
|
||||||
|
@ -384,6 +386,14 @@ func main() {
|
||||||
{
|
{
|
||||||
g.Add(
|
g.Add(
|
||||||
func() error {
|
func() error {
|
||||||
|
select {
|
||||||
|
// When the scrape manager receives a new targets list
|
||||||
|
// it needs to read a valid config for each target and
|
||||||
|
// it depends on the config being in sync with the discovery manager.
|
||||||
|
case <-reloadReady:
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
err := scrapeManager.Run(discoveryManagerScrape.SyncCh())
|
err := scrapeManager.Run(discoveryManagerScrape.SyncCh())
|
||||||
level.Info(logger).Log("msg", "Scrape manager stopped")
|
level.Info(logger).Log("msg", "Scrape manager stopped")
|
||||||
return err
|
return err
|
||||||
|
|
Loading…
Reference in a new issue