(e *echo.Echo, runtimeDebug *atomic.Bool)
| 9 | ) |
| 10 | |
| 11 | func 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 | } |
no test coverage detected