forked from TrueCloudLab/frostfs-http-gw
added reusable pprof endpoints
This commit is contained in:
parent
ad03a95feb
commit
50e74ee3a1
1 changed files with 6 additions and 0 deletions
6
pprof.go
6
pprof.go
|
@ -4,10 +4,16 @@ import (
|
||||||
"net/http/pprof"
|
"net/http/pprof"
|
||||||
rtp "runtime/pprof"
|
rtp "runtime/pprof"
|
||||||
|
|
||||||
|
"github.com/fasthttp/router"
|
||||||
"github.com/valyala/fasthttp"
|
"github.com/valyala/fasthttp"
|
||||||
"github.com/valyala/fasthttp/fasthttpadaptor"
|
"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 {
|
func pprofHandler() fasthttp.RequestHandler {
|
||||||
items := rtp.Profiles()
|
items := rtp.Profiles()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue