aboutsummaryrefslogtreecommitdiffstats
path: root/internal/debug
diff options
context:
space:
mode:
authorNick Johnson <arachnid@notdot.net>2016-10-14 15:22:31 +0800
committerNick Johnson <arachnid@notdot.net>2016-10-14 19:29:08 +0800
commit9e9bfc4e264b0bc16bdfe893e9cb3cfad096c48c (patch)
tree8fd85d22e2ab013bc772dbc76997d94c86384ed5 /internal/debug
parentc780901cd5bd46e0d9316b653e02e4a14ca43b60 (diff)
downloaddexon-9e9bfc4e264b0bc16bdfe893e9cb3cfad096c48c.tar
dexon-9e9bfc4e264b0bc16bdfe893e9cb3cfad096c48c.tar.gz
dexon-9e9bfc4e264b0bc16bdfe893e9cb3cfad096c48c.tar.bz2
dexon-9e9bfc4e264b0bc16bdfe893e9cb3cfad096c48c.tar.lz
dexon-9e9bfc4e264b0bc16bdfe893e9cb3cfad096c48c.tar.xz
dexon-9e9bfc4e264b0bc16bdfe893e9cb3cfad096c48c.tar.zst
dexon-9e9bfc4e264b0bc16bdfe893e9cb3cfad096c48c.zip
metrics, internal/debug: Add --pprofaddr flag, expose metrics via gexp
Diffstat (limited to 'internal/debug')
-rw-r--r--internal/debug/flags.go9
1 files changed, 7 insertions, 2 deletions
diff --git a/internal/debug/flags.go b/internal/debug/flags.go
index 9fc5fc4fe..ed17f87c4 100644
--- a/internal/debug/flags.go
+++ b/internal/debug/flags.go
@@ -52,6 +52,11 @@ var (
Usage: "pprof HTTP server listening port",
Value: 6060,
}
+ pprofAddrFlag = cli.StringFlag{
+ Name: "pprofaddr",
+ Usage: "pprof HTTP server listening interface",
+ Value: "127.0.0.1",
+ }
memprofilerateFlag = cli.IntFlag{
Name: "memprofilerate",
Usage: "Turn on memory profiling with the given rate",
@@ -74,7 +79,7 @@ var (
// Flags holds all command-line flags required for debugging.
var Flags = []cli.Flag{
verbosityFlag, vmoduleFlag, backtraceAtFlag,
- pprofFlag, pprofPortFlag,
+ pprofFlag, pprofAddrFlag, pprofPortFlag,
memprofilerateFlag, blockprofilerateFlag, cpuprofileFlag, traceFlag,
}
@@ -101,7 +106,7 @@ func Setup(ctx *cli.Context) error {
// pprof server
if ctx.GlobalBool(pprofFlag.Name) {
- address := fmt.Sprintf("127.0.0.1:%d", ctx.GlobalInt(pprofPortFlag.Name))
+ address := fmt.Sprintf("%s:%d", ctx.GlobalString(pprofAddrFlag.Name), ctx.GlobalInt(pprofPortFlag.Name))
go func() {
glog.V(logger.Info).Infof("starting pprof server at http://%s/debug/pprof", address)
glog.Errorln(http.ListenAndServe(address, nil))