From 6ccc0a016bd1225324389ed1659f161b37ab4801 Mon Sep 17 00:00:00 2001 From: ISHIDA Wataru Date: Tue, 28 Jun 2016 22:54:47 +0000 Subject: 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 --- gobgpd/main.go | 10 +++++++--- 1 file 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": -- cgit v1.2.3