From 50e74ee3a1053ff4f42e9d0fc85a9787ee74d899 Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Tue, 3 Mar 2020 13:35:06 +0300 Subject: [PATCH] added reusable pprof endpoints --- pprof.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pprof.go b/pprof.go index 97b6424..ef5457a 100644 --- a/pprof.go +++ b/pprof.go @@ -4,10 +4,16 @@ import ( "net/http/pprof" rtp "runtime/pprof" + "github.com/fasthttp/router" "github.com/valyala/fasthttp" "github.com/valyala/fasthttp/fasthttpadaptor" ) +func attachProfiler(r *router.Router) { + r.GET("/debug/pprof/", pprofHandler()) + r.GET("/debug/pprof/:name", pprofHandler()) +} + func pprofHandler() fasthttp.RequestHandler { items := rtp.Profiles()