MCPcopy Create free account
hub / github.com/bytebase/bytebase / registerPprof

Function registerPprof

backend/server/pprof.go:11–34  ·  view source on GitHub ↗
(e *echo.Echo, runtimeDebug *atomic.Bool)

Source from the content-addressed store, hash-verified

9)
10
11func registerPprof(e *echo.Echo, runtimeDebug *atomic.Bool) {
12 router := e.Group("/debug/pprof")
13 handler := func(h http.HandlerFunc) echo.HandlerFunc {
14 return func(c *echo.Context) error {
15 if !runtimeDebug.Load() {
16 return echo.NewHTTPError(echo.ErrNotFound.StatusCode(), "")
17 }
18 h.ServeHTTP(c.Response(), c.Request())
19 return nil
20 }
21 }
22 router.GET("/", handler(pprof.Index))
23 router.GET("/allocs", handler(pprof.Handler("allocs").ServeHTTP))
24 router.GET("/block", handler(pprof.Handler("block").ServeHTTP))
25 router.GET("/cmdline", handler(pprof.Cmdline))
26 router.GET("/goroutine", handler(pprof.Handler("goroutine").ServeHTTP))
27 router.GET("/heap", handler(pprof.Handler("heap").ServeHTTP))
28 router.GET("/mutex", handler(pprof.Handler("mutex").ServeHTTP))
29 router.GET("/profile", handler(pprof.Profile))
30 router.POST("/symbol", handler(pprof.Symbol))
31 router.GET("/symbol", handler(pprof.Symbol))
32 router.GET("/threadcreate", handler(pprof.Handler("threadcreate").ServeHTTP))
33 router.GET("/trace", handler(pprof.Trace))
34}

Callers 1

configureEchoRoutersFunction · 0.85

Calls 2

LoadMethod · 0.80
handlerFunction · 0.50

Tested by

no test coverage detected