Fix variable 'notifier' collides with imported package name 'github.com/prometheus/prometheus/notifier', changed to 'notifierManager'. (#4947)

Signed-off-by: aixeshunter <aixeshunter@gmail.com>
This commit is contained in:
AixesHunter 2018-12-18 11:13:18 +00:00 committed by Brian Brazil
parent c96828fb57
commit 1b166d7174

View file

@ -256,7 +256,7 @@ func main() {
ctxWeb, cancelWeb = context.WithCancel(context.Background()) ctxWeb, cancelWeb = context.WithCancel(context.Background())
ctxRule = context.Background() ctxRule = context.Background()
notifier = notifier.NewManager(&cfg.notifier, log.With(logger, "component", "notifier")) notifierManager = notifier.NewManager(&cfg.notifier, log.With(logger, "component", "notifier"))
ctxScrape, cancelScrape = context.WithCancel(context.Background()) ctxScrape, cancelScrape = context.WithCancel(context.Background())
discoveryManagerScrape = discovery.NewManager(ctxScrape, log.With(logger, "component", "discovery manager scrape"), discovery.Name("scrape")) discoveryManagerScrape = discovery.NewManager(ctxScrape, log.With(logger, "component", "discovery manager scrape"), discovery.Name("scrape"))
@ -279,7 +279,7 @@ func main() {
Appendable: fanoutStorage, Appendable: fanoutStorage,
TSDB: localStorage, TSDB: localStorage,
QueryFunc: rules.EngineQueryFunc(queryEngine, fanoutStorage), QueryFunc: rules.EngineQueryFunc(queryEngine, fanoutStorage),
NotifyFunc: sendAlerts(notifier, cfg.web.ExternalURL.String()), NotifyFunc: sendAlerts(notifierManager, cfg.web.ExternalURL.String()),
Context: ctxRule, Context: ctxRule,
ExternalURL: cfg.web.ExternalURL, ExternalURL: cfg.web.ExternalURL,
Registerer: prometheus.DefaultRegisterer, Registerer: prometheus.DefaultRegisterer,
@ -296,7 +296,7 @@ func main() {
cfg.web.QueryEngine = queryEngine cfg.web.QueryEngine = queryEngine
cfg.web.ScrapeManager = scrapeManager cfg.web.ScrapeManager = scrapeManager
cfg.web.RuleManager = ruleManager cfg.web.RuleManager = ruleManager
cfg.web.Notifier = notifier cfg.web.Notifier = notifierManager
cfg.web.Version = &web.PrometheusVersion{ cfg.web.Version = &web.PrometheusVersion{
Version: version.Version, Version: version.Version,
@ -332,7 +332,7 @@ func main() {
webHandler.ApplyConfig, webHandler.ApplyConfig,
// The Scrape and notifier managers need to reload before the Discovery manager as // The Scrape and notifier managers need to reload before the Discovery manager as
// they need to read the most updated config when receiving the new targets list. // they need to read the most updated config when receiving the new targets list.
notifier.ApplyConfig, notifierManager.ApplyConfig,
scrapeManager.ApplyConfig, 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)
@ -611,12 +611,12 @@ func main() {
// so we wait until the config is fully loaded. // so we wait until the config is fully loaded.
<-reloadReady.C <-reloadReady.C
notifier.Run(discoveryManagerNotify.SyncCh()) notifierManager.Run(discoveryManagerNotify.SyncCh())
level.Info(logger).Log("msg", "Notifier manager stopped") level.Info(logger).Log("msg", "Notifier manager stopped")
return nil return nil
}, },
func(err error) { func(err error) {
notifier.Stop() notifierManager.Stop()
}, },
) )
} }