TUN-2053: Add a /healthcheck endpoint to the metrics server

This commit is contained in:
Adam Chalmers 2019-11-12 16:55:40 -06:00
parent 759cd019be
commit c5af83af66
2 changed files with 5 additions and 0 deletions

1
go.mod
View File

@ -57,6 +57,7 @@ require (
golang.org/x/sync v0.0.0-20190423024810-112230192c58
golang.org/x/sys v0.0.0-20191008105621-543471e840be
golang.org/x/text v0.3.2 // indirect
google.golang.org/appengine v1.4.0 // indirect
google.golang.org/genproto v0.0.0-20191007204434-a023cd5227bd // indirect
google.golang.org/grpc v1.24.0 // indirect
gopkg.in/coreos/go-oidc.v2 v2.1.0

View File

@ -2,6 +2,7 @@ package metrics
import (
"context"
"fmt"
"net"
"net/http"
_ "net/http/pprof"
@ -33,6 +34,9 @@ func ServeMetrics(l net.Listener, shutdownC <-chan struct{}, logger *logrus.Logg
}
http.Handle("/metrics", promhttp.Handler())
http.Handle("/healthcheck", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "OK\n")
}))
wg.Add(1)
go func() {