diff options
author | Péter Szilágyi <peterke@gmail.com> | 2016-10-14 20:01:59 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-10-14 20:01:59 +0800 |
commit | c2ddfb343a22958324c0c26dae789d3937eece4f (patch) | |
tree | b9a5c194aed928738e9c66dc8cb5268e9a69b48d | |
parent | f63c6c008f6341a8a46ae1f424b0e7b43ec25583 (diff) | |
parent | 9e9bfc4e264b0bc16bdfe893e9cb3cfad096c48c (diff) | |
download | go-tangerine-c2ddfb343a22958324c0c26dae789d3937eece4f.tar go-tangerine-c2ddfb343a22958324c0c26dae789d3937eece4f.tar.gz go-tangerine-c2ddfb343a22958324c0c26dae789d3937eece4f.tar.bz2 go-tangerine-c2ddfb343a22958324c0c26dae789d3937eece4f.tar.lz go-tangerine-c2ddfb343a22958324c0c26dae789d3937eece4f.tar.xz go-tangerine-c2ddfb343a22958324c0c26dae789d3937eece4f.tar.zst go-tangerine-c2ddfb343a22958324c0c26dae789d3937eece4f.zip |
Merge pull request #3136 from Arachnid/expvar
metrics, internal/debug: Add --pprofaddr flag, expose metrics via gexp
-rw-r--r-- | internal/debug/flags.go | 9 | ||||
-rw-r--r-- | metrics/metrics.go | 2 |
2 files changed, 9 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)) diff --git a/metrics/metrics.go b/metrics/metrics.go index fcf8b5c32..7f647cd00 100644 --- a/metrics/metrics.go +++ b/metrics/metrics.go @@ -26,6 +26,7 @@ import ( "github.com/ethereum/go-ethereum/logger" "github.com/ethereum/go-ethereum/logger/glog" "github.com/rcrowley/go-metrics" + "github.com/rcrowley/go-metrics/exp" ) // MetricsEnabledFlag is the CLI flag name to use to enable metrics collections. @@ -44,6 +45,7 @@ func init() { Enabled = true } } + exp.Exp(metrics.DefaultRegistry) } // NewMeter create a new metrics Meter, either a real one of a NOP stub depending |