From cd77ecbaf6efa01652127e9af15006ec6e551ccc Mon Sep 17 00:00:00 2001 From: Kenjiro Nakayama Date: Mon, 8 Feb 2016 23:21:48 +0900 Subject: [PATCH] Support block profile by pprof webserver --- pkg/cmd/server/start/kubernetes/kubernetes.go | 2 ++ pkg/cmd/server/start/start_allinone.go | 2 ++ 2 files changed, 4 insertions(+) diff --git a/pkg/cmd/server/start/kubernetes/kubernetes.go b/pkg/cmd/server/start/kubernetes/kubernetes.go index 345052a4534f..e7520fba0323 100644 --- a/pkg/cmd/server/start/kubernetes/kubernetes.go +++ b/pkg/cmd/server/start/kubernetes/kubernetes.go @@ -5,6 +5,7 @@ import ( "io" "net/http" "os" + "runtime" "github.com/golang/glog" "github.com/spf13/cobra" @@ -46,6 +47,7 @@ func NewCommand(name, fullName string, out io.Writer) *cobra.Command { func startProfiler() { if cmdutil.Env("OPENSHIFT_PROFILE", "") == "web" { go func() { + runtime.SetBlockProfileRate(1) glog.Infof("Starting profiling endpoint at http://127.0.0.1:6060/debug/pprof/") glog.Fatal(http.ListenAndServe("127.0.0.1:6060", nil)) }() diff --git a/pkg/cmd/server/start/start_allinone.go b/pkg/cmd/server/start/start_allinone.go index a0fa19cc42cb..c149caee1d32 100644 --- a/pkg/cmd/server/start/start_allinone.go +++ b/pkg/cmd/server/start/start_allinone.go @@ -9,6 +9,7 @@ import ( _ "net/http/pprof" "os" "path" + "runtime" "strings" "github.com/coreos/go-systemd/daemon" @@ -256,6 +257,7 @@ func (o AllInOneOptions) StartAllInOne() error { func startProfiler() { if cmdutil.Env("OPENSHIFT_PROFILE", "") == "web" { go func() { + runtime.SetBlockProfileRate(1) glog.Infof("Starting profiling endpoint at http://127.0.0.1:6060/debug/pprof/") glog.Fatal(http.ListenAndServe("127.0.0.1:6060", nil)) }()