metrics: add /health endpoint for healthchecks (#84)

Because calling `/metrics` for a Consul healhcheck is too heavy
and far too verbose.

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Jakub 2021-10-15 12:47:40 +02:00 committed by GitHub
parent 21aba7cd65
commit 1c991a94d8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 0 deletions

View File

@ -40,6 +40,11 @@ func NewMetricsServer(address string, port int) *Server {
mux := http.NewServeMux()
mux.Handle("/metrics", pe)
// Healthcheck
mux.HandleFunc("/health", func(w http.ResponseWriter, r *http.Request) {
fmt.Fprint(w, "OK")
})
h := &ochttp.Handler{Handler: mux}
// Register the views