Skip to content
This repository was archived by the owner on Aug 18, 2025. It is now read-only.

Commit bbeea0d

Browse files
authored
Merge pull request #40 from v3io/development
Development --> Master (v2.8.0-1-v0.9.1)
2 parents f3568a4 + 8c7a02d commit bbeea0d

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

web/web.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -341,20 +341,22 @@ func New(logger log.Logger, o *Options) *Handler {
341341
router.Get("/-/healthy", func(w http.ResponseWriter, r *http.Request) {
342342
if o.V3ioConfig == nil {
343343
w.WriteHeader(http.StatusInternalServerError)
344+
level.Warn(h.logger).Log("msg", "Prometheus is Unhealthy: still waiting on V3IO storage.")
344345
fmt.Fprintf(w, "Prometheus is Unhealthy: still waiting on V3IO storage.\n")
345346
return
346347
}
347348
schemaUrl := "http://" + path.Join(o.V3ioConfig.WebApiEndpoint, o.V3ioConfig.Container, o.V3ioConfig.TablePath, ".schema")
348349
req, err := http.NewRequest("GET", schemaUrl, nil)
349350
if err != nil {
350351
w.WriteHeader(http.StatusInternalServerError)
352+
level.Warn(h.logger).Log("msg", "Prometheus is Unhealthy.", "error", err)
351353
fmt.Fprintf(w, "Prometheus is Unhealthy: %v\n", err)
352354
return
353355
}
354356
req.Header.Add("X-v3io-function", "GetItem")
355-
req.Body = ioutil.NopCloser(strings.NewReader(`{AttibutesToGet:"__name"}`))
357+
req.Body = ioutil.NopCloser(strings.NewReader(`{"AttributesToGet":"__name"}`))
356358
if o.V3ioConfig.AccessKey != "" {
357-
req.Header.Add("X-v3io-access-key", o.V3ioConfig.AccessKey)
359+
req.Header.Add("X-v3io-session-key", o.V3ioConfig.AccessKey)
358360
} else if o.V3ioConfig.Password != "" {
359361
base64UserPassword := base64.StdEncoding.EncodeToString([]byte(o.V3ioConfig.Username + ":" + o.V3ioConfig.Password))
360362
req.Header.Add("Authorization", "Basic "+base64UserPassword)
@@ -363,24 +365,29 @@ func New(logger log.Logger, o *Options) *Handler {
363365
resp, err := client.Do(req)
364366
if err != nil {
365367
w.WriteHeader(http.StatusInternalServerError)
368+
level.Warn(h.logger).Log("msg", "Prometheus is Unhealthy.", "error", err)
366369
fmt.Fprintf(w, "Prometheus is Unhealthy: %v\n", err)
367370
return
368371
}
369372
if resp.StatusCode != http.StatusOK {
370373
w.WriteHeader(http.StatusInternalServerError)
374+
level.Warn(h.logger).Log("msg", "Prometheus is Unhealthy because it could not find schema file.", "schemaUrl", schemaUrl, "response", resp)
371375
fmt.Fprintf(w, "Prometheus is Unhealthy because it could not find %s: %+v\n", schemaUrl, resp)
372376
return
373377
}
374378
w.WriteHeader(http.StatusOK)
379+
level.Info(h.logger).Log("msg", "Prometheus is Healthy.")
375380
fmt.Fprintf(w, "Prometheus is Healthy.\n")
376381
})
377382
router.Get("/-/ready", readyf(func(w http.ResponseWriter, r *http.Request) {
378383
if o.V3ioConfig == nil {
379384
w.WriteHeader(http.StatusInternalServerError)
385+
level.Warn(h.logger).Log("msg", "Prometheus is not ready: still waiting on V3IO storage.")
380386
fmt.Fprintf(w, "Prometheus is not ready: still waiting on V3IO storage.\n")
381387
return
382388
}
383389
w.WriteHeader(http.StatusOK)
390+
level.Info(h.logger).Log("msg", "Prometheus is Ready.")
384391
fmt.Fprintf(w, "Prometheus is Ready.\n")
385392
}))
386393

0 commit comments

Comments
 (0)