Healthy is used to report the health of the Pushgateway. It currently only uses the Healthy method of the MetricScore to detect healthy state. The returned handler is already instrumented for Prometheus.
(ms storage.MetricStore)
| 27 | // |
| 28 | // The returned handler is already instrumented for Prometheus. |
| 29 | func Healthy(ms storage.MetricStore) http.Handler { |
| 30 | return InstrumentWithCounter( |
| 31 | "healthy", |
| 32 | http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) { |
| 33 | err := ms.Healthy() |
| 34 | if err == nil { |
| 35 | io.WriteString(w, "OK") |
| 36 | } else { |
| 37 | http.Error(w, err.Error(), http.StatusInternalServerError) |
| 38 | } |
| 39 | }), |
| 40 | ) |
| 41 | } |
| 42 | |
| 43 | // Ready is used to report if the Pushgateway is ready to process requests. It |
| 44 | // currently only uses the Ready method of the MetricScore to detect ready |
searching dependent graphs…