diff options
author | ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> | 2016-06-28 22:54:47 +0000 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2016-06-15 23:25:50 +0900 |
commit | 6ccc0a016bd1225324389ed1659f161b37ab4801 (patch) | |
tree | bb591b2130b91e5189cd62abba650954da203ea1 /gobgpd/main.go | |
parent | be0ebd60ff6be10c915143060962fce22ba9269d (diff) |
gobgpd: add an option to change/disable pprof setting
use `--pprof-disable` to disable pprof
use `--pprof-host` to change pprof listening host
Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
Diffstat (limited to 'gobgpd/main.go')
-rw-r--r-- | gobgpd/main.go | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/gobgpd/main.go b/gobgpd/main.go index 8dddfa51..63d71024 100644 --- a/gobgpd/main.go +++ b/gobgpd/main.go @@ -52,6 +52,8 @@ func main() { GrpcHosts string `long:"api-hosts" description:"specify the hosts that gobgpd listens on" default:":50051"` GracefulRestart bool `short:"r" long:"graceful-restart" description:"flag restart-state in graceful-restart capability"` Dry bool `short:"d" long:"dry-run" description:"check configuration"` + PProfHost string `long:"pprof-host" description:"specify the host that gobgpd listens on for pprof" default:"localhost:6060"` + PProfDisable bool `long:"pprof-disable" description:"disable pprof profiling"` } _, err := flags.Parse(&opts) if err != nil { @@ -68,9 +70,11 @@ func main() { runtime.GOMAXPROCS(opts.CPUs) } - go func() { - log.Println(http.ListenAndServe("localhost:6060", nil)) - }() + if !opts.PProfDisable { + go func() { + log.Println(http.ListenAndServe(opts.PProfHost, nil)) + }() + } switch opts.LogLevel { case "debug": |