diff --git a/web/web.go b/web/web.go index e6f19452279..e0cf0257cfd 100644 --- a/web/web.go +++ b/web/web.go @@ -341,6 +341,7 @@ func New(logger log.Logger, o *Options) *Handler { router.Get("/-/healthy", func(w http.ResponseWriter, r *http.Request) { if o.V3ioConfig == nil { w.WriteHeader(http.StatusInternalServerError) + level.Warn(h.logger).Log("msg", "Prometheus is Unhealthy: still waiting on V3IO storage.") fmt.Fprintf(w, "Prometheus is Unhealthy: still waiting on V3IO storage.\n") return } @@ -348,6 +349,7 @@ func New(logger log.Logger, o *Options) *Handler { req, err := http.NewRequest("GET", schemaUrl, nil) if err != nil { w.WriteHeader(http.StatusInternalServerError) + level.Warn(h.logger).Log("msg", "Prometheus is Unhealthy.", "error", err) fmt.Fprintf(w, "Prometheus is Unhealthy: %v\n", err) return } @@ -363,24 +365,29 @@ func New(logger log.Logger, o *Options) *Handler { resp, err := client.Do(req) if err != nil { w.WriteHeader(http.StatusInternalServerError) + level.Warn(h.logger).Log("msg", "Prometheus is Unhealthy.", "error", err) fmt.Fprintf(w, "Prometheus is Unhealthy: %v\n", err) return } if resp.StatusCode != http.StatusOK { w.WriteHeader(http.StatusInternalServerError) + level.Warn(h.logger).Log("msg", "Prometheus is Unhealthy because it could not find schema file.", "schemaUrl", schemaUrl, "response", resp) fmt.Fprintf(w, "Prometheus is Unhealthy because it could not find %s: %+v\n", schemaUrl, resp) return } w.WriteHeader(http.StatusOK) + level.Info(h.logger).Log("msg", "Prometheus is Healthy.") fmt.Fprintf(w, "Prometheus is Healthy.\n") }) router.Get("/-/ready", readyf(func(w http.ResponseWriter, r *http.Request) { if o.V3ioConfig == nil { w.WriteHeader(http.StatusInternalServerError) + level.Warn(h.logger).Log("msg", "Prometheus is not ready: still waiting on V3IO storage.") fmt.Fprintf(w, "Prometheus is not ready: still waiting on V3IO storage.\n") return } w.WriteHeader(http.StatusOK) + level.Info(h.logger).Log("msg", "Prometheus is Ready.") fmt.Fprintf(w, "Prometheus is Ready.\n") }))