MCPcopy
hub / github.com/prometheus/pushgateway / Healthy

Function Healthy

handler/misc.go:29–41  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

27//
28// The returned handler is already instrumented for Prometheus.
29func 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

Callers 2

mainFunction · 0.92
TestHealthyReadyFunction · 0.85

Calls 3

InstrumentWithCounterFunction · 0.85
ErrorMethod · 0.80
HealthyMethod · 0.65

Tested by 1

TestHealthyReadyFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…