Notify web UI when starting up and shutting down

Signed-off-by: Julien <roidelapluie@o11y.eu>
pull/15082/head
Julien 2 months ago
parent 199d2fb492
commit b6158e8956

@ -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

@ -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.

Loading…
Cancel
Save