github.com/volts-dev/volts@v0.0.0-20240120094013-5e9c65924106/router/pprof.go (about)

     1  package router
     2  
     3  import (
     4  	"net/http/pprof"
     5  )
     6  
     7  const (
     8  	// DefaultPrefix url prefix of pprof
     9  	DefaultPrefix = "/debug/pprof"
    10  )
    11  
    12  func pprofGroup() *TGroup {
    13  	group := NewGroup(
    14  		WithGroupPathPrefix(DefaultPrefix),
    15  	)
    16  
    17  	group.Url("GET", "//", pprof.Index) //  "//" will tansfer to "/" like "/debug/pprof/"
    18  	group.Url("GET", "/cmdline", pprof.Cmdline)
    19  	group.Url("GET", "/profile", pprof.Profile)
    20  	group.Url("POST", "/symbol", pprof.Symbol)
    21  	group.Url("GET", "/symbol", pprof.Symbol)
    22  	group.Url("GET", "/trace", pprof.Trace)
    23  	group.Url("GET", "/allocs", pprof.Handler("allocs"))
    24  	group.Url("GET", "/block", pprof.Handler("block"))
    25  	group.Url("GET", "/goroutine", pprof.Handler("goroutine"))
    26  	group.Url("GET", "/heap", pprof.Handler("heap"))
    27  	group.Url("GET", "/mutex", pprof.Handler("mutex"))
    28  	group.Url("GET", "/threadcreate", pprof.Handler("threadcreate"))
    29  
    30  	return group
    31  }