Merge pull request #161 from calavera/enable_pprof

Enable http pprof connections when pprof-address flag is set
This commit is contained in:
Michael Crosby
2016-03-25 17:27:08 -07:00
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"
@@ -39,6 +40,10 @@ func setAppBefore(app *cli.App) {
return err
}
}
}
if p := context.GlobalString("pprof-address"); len(p) > 0 {
pprof.Enable(p)
}
if err := checkLimits(); err != nil {
return err