daemon: expose prometheus metrics on pprof listener (useful for debugging)

This commit is contained in:
Christian Schwarz 2020-05-17 13:56:48 +02:00
parent 2fbd9d8f8c
commit 7d6ee4c166

View File

@ -8,6 +8,7 @@ import (
"net"
"net/http/pprof"
"github.com/prometheus/client_golang/prometheus/promhttp"
"github.com/zrepl/zrepl/daemon/job"
)
@ -64,6 +65,7 @@ outer:
mux.Handle("/debug/pprof/profile", http.HandlerFunc(pprof.Profile))
mux.Handle("/debug/pprof/symbol", http.HandlerFunc(pprof.Symbol))
mux.Handle("/debug/pprof/trace", http.HandlerFunc(pprof.Trace))
mux.Handle("/metrics", promhttp.Handler())
go func() {
err := http.Serve(s.listener, mux)
if ctx.Err() != nil {