mirror of
https://github.com/prometheus/prometheus.git
synced 2025-01-11 13:57:36 -08:00
Notify web UI when starting up and shutting down
Signed-off-by: Julien <roidelapluie@o11y.eu>
This commit is contained in:
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…
Reference in a new issue