Fix variable 'notifier' collides with imported package name 'github.com/prometheus/prometheus/notifier', changed to 'notifierManager'.
@@ -256,7 +256,7 @@ func main() {
ctxWeb, cancelWeb = context.WithCancel(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())
discoveryManagerScrape = discovery.NewManager(ctxScrape, log.With(logger, "component", "discovery manager scrape"), discovery.Name("scrape"))
@@ -279,7 +279,7 @@ func main() {
Appendable: fanoutStorage,
TSDB: localStorage,
QueryFunc: rules.EngineQueryFunc(queryEngine, fanoutStorage),
- NotifyFunc: sendAlerts(notifier, cfg.web.ExternalURL.String()),
+ NotifyFunc: sendAlerts(notifierManager, cfg.web.ExternalURL.String()),
Context: ctxRule,
ExternalURL: cfg.web.ExternalURL,
Registerer: prometheus.DefaultRegisterer,
@@ -296,7 +296,7 @@ func main() {
cfg.web.QueryEngine = queryEngine
cfg.web.ScrapeManager = scrapeManager
cfg.web.RuleManager = ruleManager
- cfg.web.Notifier = notifier
+ cfg.web.Notifier = notifierManager
cfg.web.Version = &web.PrometheusVersion{
Version: version.Version,
@@ -332,7 +332,7 @@ func main() {
webHandler.ApplyConfig,
// 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.
- notifier.ApplyConfig,
+ notifierManager.ApplyConfig,
scrapeManager.ApplyConfig,
func(cfg *config.Config) error {
c := make(map[string]sd_config.ServiceDiscoveryConfig)
@@ -611,12 +611,12 @@ func main() {
// so we wait until the config is fully loaded.
<-reloadReady.C
- notifier.Run(discoveryManagerNotify.SyncCh())
+ notifierManager.Run(discoveryManagerNotify.SyncCh())
level.Info(logger).Log("msg", "Notifier manager stopped")
return nil
},
func(err error) {
- notifier.Stop()
+ notifierManager.Stop()
},
)
}
