summaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'main.go')
-rw-r--r--main.go19
1 files changed, 19 insertions, 0 deletions
diff --git a/main.go b/main.go
index e47d311..6923554 100644
--- a/main.go
+++ b/main.go
@@ -7,6 +7,7 @@ import (
"flag"
"net"
"net/http"
+ "net/http/pprof"
"os"
"strconv"
"time"
@@ -68,6 +69,24 @@ func main() {
},
})
+ if cfg.Pprof.Port != 0 {
+ mux := http.NewServeMux()
+
+ mux.HandleFunc("/debug/pprof/", pprof.Index)
+ mux.HandleFunc("/debug/pprof/cmdline", pprof.Cmdline)
+ mux.HandleFunc("/debug/pprof/profile", pprof.Profile)
+ mux.HandleFunc("/debug/pprof/symbol", pprof.Symbol)
+ mux.HandleFunc("/debug/pprof/trace", pprof.Trace)
+
+ m.Add(&server.Server{
+ Name: "pprof",
+ Server: &http.Server{
+ Addr: net.JoinHostPort(cfg.Pprof.Host, strconv.Itoa(cfg.Pprof.Port)),
+ Handler: mux,
+ },
+ })
+ }
+
if err := m.Start(signals.SetupSignalHandler()); err != nil {
logger.Info().Err(err).Msg("manager stopped")
}