Merge pull request #7953 from gyuho/aaa

etcd-tester: use 'debugutil.PProfHandlers'
release-3.2
Gyu-Ho Lee 2017-05-18 11:26:40 -07:00 committed by GitHub
commit e7d705b25f
1 changed files with 5 additions and 10 deletions

View File

@ -18,10 +18,11 @@ import (
"flag" "flag"
"fmt" "fmt"
"net/http" "net/http"
"net/http/pprof"
"os" "os"
"strings" "strings"
"github.com/coreos/etcd/pkg/debugutil"
"github.com/coreos/pkg/capnslog" "github.com/coreos/pkg/capnslog"
"github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus"
"golang.org/x/time/rate" "golang.org/x/time/rate"
@ -138,15 +139,9 @@ func main() {
http.Handle("/metrics", prometheus.Handler()) http.Handle("/metrics", prometheus.Handler())
if *enablePprof { if *enablePprof {
http.Handle(pprofPrefix+"/", http.HandlerFunc(pprof.Index)) for p, h := range debugutil.PProfHandlers() {
http.Handle(pprofPrefix+"/profile", http.HandlerFunc(pprof.Profile)) http.Handle(p, h)
http.Handle(pprofPrefix+"/symbol", http.HandlerFunc(pprof.Symbol)) }
http.Handle(pprofPrefix+"/cmdline", http.HandlerFunc(pprof.Cmdline))
http.Handle(pprofPrefix+"/trace", http.HandlerFunc(pprof.Trace))
http.Handle(pprofPrefix+"/heap", pprof.Handler("heap"))
http.Handle(pprofPrefix+"/goroutine", pprof.Handler("goroutine"))
http.Handle(pprofPrefix+"/threadcreate", pprof.Handler("threadcreate"))
http.Handle(pprofPrefix+"/block", pprof.Handler("block"))
} }
go func() { plog.Fatal(http.ListenAndServe(":9028", nil)) }() go func() { plog.Fatal(http.ListenAndServe(":9028", nil)) }()