From 7d6ee4c1665424649c0490d89dd119883d2fa1cf Mon Sep 17 00:00:00 2001 From: Christian Schwarz Date: Sun, 17 May 2020 13:56:48 +0200 Subject: [PATCH] daemon: expose prometheus metrics on pprof listener (useful for debugging) --- daemon/pprof.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/daemon/pprof.go b/daemon/pprof.go index 8a6ff1a..7cb1a5c 100644 --- a/daemon/pprof.go +++ b/daemon/pprof.go @@ -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 {