Skip to content

Commit

Permalink
add if for enable debug
Browse files Browse the repository at this point in the history
  • Loading branch information
moutonjeremy committed Mar 13, 2021
1 parent 05e74d0 commit 6899c92
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions pkg/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,14 @@ func RunServer(ctx *cli.Context) error {
ctx.WriteString("/metrics")
})
r.GET("/metrics", prometheusHandler())
r.GET("/debug/pprof/", pprofHandlerIndex)
r.GET("/debug/pprof/cmdline", pprofHandlerCmdline)
r.GET("/debug/pprof/profile", pprofHandlerIndex)
r.GET("/debug/pprof/trace", pprofHandlerTrace)
r.GET("/debug/pprof/{profile}", pprofHandlerIndex)

if config.Debug {
r.GET("/debug/pprof/", pprofHandlerIndex)
r.GET("/debug/pprof/cmdline", pprofHandlerCmdline)
r.GET("/debug/pprof/profile", pprofHandlerIndex)
r.GET("/debug/pprof/trace", pprofHandlerTrace)
r.GET("/debug/pprof/{profile}", pprofHandlerIndex)
}

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

0 comments on commit 6899c92

Please sign in to comment.