diff --git a/cmd/prometheus/main.go b/cmd/prometheus/main.go index d8369770b..8ad1db637 100644 --- a/cmd/prometheus/main.go +++ b/cmd/prometheus/main.go @@ -503,6 +503,7 @@ func main() { notifs := api.NewNotifications(cfg.maxNotificationsSubscribers, prometheus.DefaultRegisterer) cfg.web.NotificationsSub = notifs.Sub cfg.web.NotificationsGetter = notifs.Get + notifs.AddNotification(api.StartingUp) if err := cfg.setFeatureListOptions(logger); err != nil { fmt.Fprintln(os.Stderr, fmt.Errorf("Error parsing feature list: %w", err)) @@ -989,6 +990,7 @@ func main() { func(err error) { close(cancel) webHandler.SetReady(web.Stopping) + notifs.AddNotification(api.ShuttingDown) }, ) } @@ -1174,6 +1176,7 @@ func main() { reloadReady.Close() webHandler.SetReady(web.Ready) + notifs.DeleteNotification(api.StartingUp) level.Info(logger).Log("msg", "Server is ready to receive web requests.") <-cancel return nil diff --git a/web/api/notifications.go b/web/api/notifications.go index 976f0b076..a838fbd98 100644 --- a/web/api/notifications.go +++ b/web/api/notifications.go @@ -22,6 +22,8 @@ import ( const ( ConfigurationUnsuccessful = "Configuration reload has failed." + StartingUp = "Prometheus is starting and replaying the write-ahead log (WAL)." + ShuttingDown = "Prometheus is shutting down and gracefully stopping all operations." ) // Notification represents an individual notification message.