1
0
mirror of https://github.com/go-kratos/kratos.git synced 2024-12-30 21:19:57 +02:00

add pprof handler (#1587)

This commit is contained in:
Tony Chen 2021-10-27 23:50:45 +08:00 committed by GitHub
parent ef686a1cc7
commit b353ab91f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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
}