Enable http pprof connections when pprof-address is set.

Add flag to specify the address where those connections listen.

Signed-off-by: David Calavera <david.calavera@gmail.com>
This commit is contained in:
David Calavera
2016-03-25 13:25:37 -04:00
parent a06dec80cd
commit 06bcd7d03c
3 changed files with 51 additions and 0 deletions

View File

@@ -55,6 +55,10 @@ var daemonFlags = []cli.Flag{
Value: &cli.StringSlice{},
Usage: "specify additional runtime args",
},
cli.StringFlag{
Name: "pprof-address",
Usage: "http address to listen for pprof events",
},
}
func main() {

View File

@@ -12,6 +12,7 @@ import (
"github.com/cloudfoundry/gosigar"
"github.com/codegangsta/cli"
"github.com/cyberdelia/go-metrics-graphite"
"github.com/docker/containerd/api/http/pprof"
"github.com/docker/containerd/osutils"
"github.com/docker/containerd/supervisor"
"github.com/rcrowley/go-metrics"
@@ -37,6 +38,10 @@ func setAppBefore(app *cli.App) {
if err := debugMetrics(context.GlobalDuration("metrics-interval"), context.GlobalString("graphite-address")); err != nil {
return err
}
}
if p := context.GlobalString("pprof-address"); len(p) > 0 {
pprof.Enable(p)
}
if err := checkLimits(); err != nil {
return err