Overloaded (#1364)

* plugin/health: add 'overloaded metrics'

Query our on health endpoint and record (and export as a metric) the
time it takes. The Get has a 5s timeout, that, when reached, will set
the metric duration to 5s. The actually call "I'm I overloaded" is left
to an external entity.

* README

* golint and govet

* and the tests
This commit is contained in:
Miek Gieben
2018-01-10 11:41:22 +00:00
committed by GitHub
parent cced1a4c12
commit 48059a6c3e
5 changed files with 90 additions and 7 deletions

View File

@@ -13,10 +13,10 @@ func TestHealth(t *testing.T) {
h := health{Addr: ":0"}
h.h = append(h.h, &erratic.Erratic{})
if err := h.Startup(); err != nil {
if err := h.OnStartup(); err != nil {
t.Fatalf("Unable to startup the health server: %v", err)
}
defer h.Shutdown()
defer h.OnShutdown()
// Reconstruct the http address based on the port allocated by operating system.
address := fmt.Sprintf("http://%s%s", h.ln.Addr().String(), path)