diff --git a/cmd/prometheus/main.go b/cmd/prometheus/main.go index 962cd9a57..93898863a 100644 --- a/cmd/prometheus/main.go +++ b/cmd/prometheus/main.go @@ -361,6 +361,7 @@ func main() { var g group.Group { + // Termination handler. term := make(chan os.Signal) signal.Notify(term, os.Interrupt, syscall.SIGTERM) cancel := make(chan struct{}) @@ -386,6 +387,7 @@ func main() { ) } { + // Scrape discovery manager. g.Add( func() error { err := discoveryManagerScrape.Run() @@ -399,6 +401,7 @@ func main() { ) } { + // Notify discovery manager. g.Add( func() error { err := discoveryManagerNotify.Run() @@ -412,6 +415,7 @@ func main() { ) } { + // Scrape manager. g.Add( func() error { // When the scrape manager receives a new targets list @@ -433,6 +437,8 @@ func main() { ) } { + // Reload handler. + // Make sure that sighup handler is registered with a redirect to the channel before the potentially // long and synchronous tsdb init. hup := make(chan os.Signal) @@ -467,6 +473,7 @@ func main() { ) } { + // Initial configuration loading. cancel := make(chan struct{}) g.Add( func() error { @@ -496,6 +503,7 @@ func main() { ) } { + // TSDB. cancel := make(chan struct{}) g.Add( func() error { @@ -526,6 +534,7 @@ func main() { ) } { + // Web handler. g.Add( func() error { if err := webHandler.Run(ctxWeb); err != nil { @@ -542,6 +551,8 @@ func main() { ) } { + // Rule manager. + // TODO(krasi) refactor ruleManager.Run() to be blocking to avoid using an extra blocking channel. cancel := make(chan struct{}) g.Add( @@ -557,6 +568,8 @@ func main() { ) } { + // Notifier. + // Calling notifier.Stop() before ruleManager.Stop() will cause a panic if the ruleManager isn't running, // so keep this interrupt after the ruleManager.Stop(). g.Add(