diff options
Diffstat (limited to 'plugin/health/overloaded.go')
-rw-r--r-- | plugin/health/overloaded.go | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/plugin/health/overloaded.go b/plugin/health/overloaded.go index d996827c0..3a4c5f08b 100644 --- a/plugin/health/overloaded.go +++ b/plugin/health/overloaded.go @@ -26,7 +26,8 @@ func (h *health) overloaded() { start := time.Now() resp, err := client.Get(url) if err != nil { - HealthDuration.Observe(timeout.Seconds()) + HealthDuration.Observe(time.Since(start).Seconds()) + HealthFailures.Inc() log.Warningf("Local health request to %q failed: %s", url, err) continue } @@ -49,7 +50,14 @@ var ( Namespace: plugin.Namespace, Subsystem: "health", Name: "request_duration_seconds", - Buckets: plugin.TimeBuckets, + Buckets: plugin.SlimTimeBuckets, Help: "Histogram of the time (in seconds) each request took.", }) + // HealthFailures is the metric used to count how many times the thealth request failed + HealthFailures = promauto.NewCounter(prometheus.CounterOpts{ + Namespace: plugin.Namespace, + Subsystem: "health", + Name: "request_failures_total", + Help: "The number of times the health check failed.", + }) ) |