diff --git a/web/web.go b/web/web.go index e6f19452279..e0f25d2010e 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,13 +349,14 @@ 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 } req.Header.Add("X-v3io-function", "GetItem") - req.Body = ioutil.NopCloser(strings.NewReader(`{AttibutesToGet:"__name"}`)) + req.Body = ioutil.NopCloser(strings.NewReader(`{"AttributesToGet":"__name"}`)) if o.V3ioConfig.AccessKey != "" { - req.Header.Add("X-v3io-access-key", o.V3ioConfig.AccessKey) + req.Header.Add("X-v3io-session-key", o.V3ioConfig.AccessKey) } else if o.V3ioConfig.Password != "" { base64UserPassword := base64.StdEncoding.EncodeToString([]byte(o.V3ioConfig.Username + ":" + o.V3ioConfig.Password)) req.Header.Add("Authorization", "Basic "+base64UserPassword) @@ -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") }))