From b353ab91f1a62d071bf9a0c01f52e2d76538dc86 Mon Sep 17 00:00:00 2001 From: Tony Chen Date: Wed, 27 Oct 2021 23:50:45 +0800 Subject: [PATCH] add pprof handler (#1587) --- transport/http/pprof/pprof.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 transport/http/pprof/pprof.go diff --git a/transport/http/pprof/pprof.go b/transport/http/pprof/pprof.go new file mode 100644 index 000000000..eab56bf61 --- /dev/null +++ b/transport/http/pprof/pprof.go @@ -0,0 +1,17 @@ +package pprof + +import ( + "net/http" + "net/http/pprof" +) + +// NewHandler new a pprof handler. +func NewHandler() http.Handler { + 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) + return mux +}