Skip to content

Commit 6899c92

Browse files
committed
add if for enable debug
1 parent 05e74d0 commit 6899c92

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

pkg/server/server.go

+8-5
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,14 @@ func RunServer(ctx *cli.Context) error {
2020
ctx.WriteString("/metrics")
2121
})
2222
r.GET("/metrics", prometheusHandler())
23-
r.GET("/debug/pprof/", pprofHandlerIndex)
24-
r.GET("/debug/pprof/cmdline", pprofHandlerCmdline)
25-
r.GET("/debug/pprof/profile", pprofHandlerIndex)
26-
r.GET("/debug/pprof/trace", pprofHandlerTrace)
27-
r.GET("/debug/pprof/{profile}", pprofHandlerIndex)
23+
24+
if config.Debug {
25+
r.GET("/debug/pprof/", pprofHandlerIndex)
26+
r.GET("/debug/pprof/cmdline", pprofHandlerCmdline)
27+
r.GET("/debug/pprof/profile", pprofHandlerIndex)
28+
r.GET("/debug/pprof/trace", pprofHandlerTrace)
29+
r.GET("/debug/pprof/{profile}", pprofHandlerIndex)
30+
}
2831

2932
log.Print("exporter listening on 0.0.0.0:" + strconv.Itoa(config.Port))
3033
return fasthttp.ListenAndServe(":"+strconv.Itoa(config.Port), r.Handler)

0 commit comments

Comments
 (0)