register health handler with HandleFunc
This commit is contained in:
parent
b41654f0ce
commit
641bd6a9e9
@ -118,9 +118,6 @@ func (h *graphHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|||||||
w.Write(output)
|
w.Write(output)
|
||||||
}
|
}
|
||||||
|
|
||||||
type healthHandler struct {
|
func healthHandler(w http.ResponseWriter, _ *http.Request) {
|
||||||
}
|
|
||||||
|
|
||||||
func (h *healthHandler) ServeHTTP(w http.ResponseWriter, _ *http.Request) {
|
|
||||||
w.WriteHeader(http.StatusOK)
|
w.WriteHeader(http.StatusOK)
|
||||||
}
|
}
|
||||||
|
@ -196,7 +196,7 @@ func Main() error {
|
|||||||
{
|
{
|
||||||
// Run the HTTP server.
|
// Run the HTTP server.
|
||||||
mux := http.NewServeMux()
|
mux := http.NewServeMux()
|
||||||
mux.Handle("/health", &healthHandler{})
|
mux.HandleFunc("/health", healthHandler)
|
||||||
mux.Handle("/graph", &graphHandler{m, gr, hostname, s})
|
mux.Handle("/graph", &graphHandler{m, gr, hostname, s})
|
||||||
mux.Handle("/metrics", promhttp.HandlerFor(r, promhttp.HandlerOpts{}))
|
mux.Handle("/metrics", promhttp.HandlerFor(r, promhttp.HandlerOpts{}))
|
||||||
l, err := net.Listen("tcp", *listen)
|
l, err := net.Listen("tcp", *listen)
|
||||||
|
Loading…
Reference in New Issue
Block a user