register health handler with HandleFunc

This commit is contained in:
Steffen Vogel 2021-07-16 12:10:13 +02:00
parent b41654f0ce
commit 641bd6a9e9
2 changed files with 2 additions and 5 deletions

View File

@ -118,9 +118,6 @@ func (h *graphHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
w.Write(output)
}
type healthHandler struct {
}
func (h *healthHandler) ServeHTTP(w http.ResponseWriter, _ *http.Request) {
func healthHandler(w http.ResponseWriter, _ *http.Request) {
w.WriteHeader(http.StatusOK)
}

View File

@ -196,7 +196,7 @@ func Main() error {
{
// Run the HTTP server.
mux := http.NewServeMux()
mux.Handle("/health", &healthHandler{})
mux.HandleFunc("/health", healthHandler)
mux.Handle("/graph", &graphHandler{m, gr, hostname, s})
mux.Handle("/metrics", promhttp.HandlerFor(r, promhttp.HandlerOpts{}))
l, err := net.Listen("tcp", *listen)