Skip to content

Commit

Permalink
Call functions to enable block/mutex pprof profiles.
Browse files Browse the repository at this point in the history
According to the documentation[1], specific functions must be called for
block and mutex pprof profiles to be generated actually. This change
does so in case the debug mode is enabled.

[1]https://golang.org/pkg/net/http/pprof/
  • Loading branch information
timoreimann authored and traefiker committed Jul 6, 2018
1 parent 689f120 commit 084b69f
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions api/debug.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ func (g DebugHandler) AddRoutes(router *mux.Router) {
fmt.Fprint(w, "\n}\n")
})

runtime.SetBlockProfileRate(1)
runtime.SetMutexProfileFraction(5)
router.Methods(http.MethodGet).PathPrefix("/debug/pprof/cmdline").HandlerFunc(pprof.Cmdline)
router.Methods(http.MethodGet).PathPrefix("/debug/pprof/profile").HandlerFunc(pprof.Profile)
router.Methods(http.MethodGet).PathPrefix("/debug/pprof/symbol").HandlerFunc(pprof.Symbol)
Expand Down

0 comments on commit 084b69f

Please sign in to comment.