11package pprof
22
33import (
4- "expvar"
5- "fmt"
4+ _ "expvar"
65 "net/http"
76 "net/http/pprof"
87
@@ -12,11 +11,6 @@ import (
1211func Enable (address string ) {
1312 http .Handle ("/" , http .RedirectHandler ("/debug/pprof" , http .StatusMovedPermanently ))
1413
15- http .Handle ("/debug/vars" , http .HandlerFunc (expVars ))
16- http .Handle ("/debug/pprof/" , http .HandlerFunc (pprof .Index ))
17- http .Handle ("/debug/pprof/cmdline" , http .HandlerFunc (pprof .Cmdline ))
18- http .Handle ("/debug/pprof/profile" , http .HandlerFunc (pprof .Profile ))
19- http .Handle ("/debug/pprof/symbol" , http .HandlerFunc (pprof .Symbol ))
2014 http .Handle ("/debug/pprof/block" , pprof .Handler ("block" ))
2115 http .Handle ("/debug/pprof/heap" , pprof .Handler ("heap" ))
2216 http .Handle ("/debug/pprof/goroutine" , pprof .Handler ("goroutine" ))
@@ -25,18 +19,3 @@ func Enable(address string) {
2519 go http .ListenAndServe (address , nil )
2620 logrus .Debug ("pprof listening in address %s" , address )
2721}
28-
29- // Replicated from expvar.go as not public.
30- func expVars (w http.ResponseWriter , r * http.Request ) {
31- first := true
32- w .Header ().Set ("Content-Type" , "application/json; charset=utf-8" )
33- fmt .Fprintf (w , "{\n " )
34- expvar .Do (func (kv expvar.KeyValue ) {
35- if ! first {
36- fmt .Fprintf (w , ",\n " )
37- }
38- first = false
39- fmt .Fprintf (w , "%q: %s" , kv .Key , kv .Value )
40- })
41- fmt .Fprintf (w , "\n }\n " )
42- }
0 commit comments