github.com/whiteboxio/flow@v0.0.3-0.20190918184116-508d75d68a2c/web/app/agent/pprof.go (about) 1 package agent 2 3 import ( 4 "net/http" 5 "net/http/pprof" 6 7 core "github.com/awesome-flow/flow/pkg/corev1alpha1" 8 ) 9 10 type PprofPage struct { 11 Title string 12 } 13 14 func init() { 15 RegisterWebAgent( 16 func(*core.Context) (WebAgent, error) { 17 return NewDummyWebAgent( 18 "/pprof/", 19 //pprof.Index, 20 func(rw http.ResponseWriter, req *http.Request) { 21 respondWith(rw, RespHtml, "pprof", &PprofPage{Title: "pprof debug info"}) 22 }, 23 ), nil 24 }, 25 ) 26 27 RegisterWebAgent( 28 func(*core.Context) (WebAgent, error) { 29 return &DummyWebAgent{ 30 path: "/pprof/heap", 31 handler: pprof.Handler("heap"), 32 }, nil 33 }, 34 ) 35 36 RegisterWebAgent( 37 func(*core.Context) (WebAgent, error) { 38 return NewDummyWebAgent( 39 "/pprof/cmdline", 40 pprof.Cmdline, 41 ), nil 42 }, 43 ) 44 45 RegisterWebAgent( 46 func(*core.Context) (WebAgent, error) { 47 return NewDummyWebAgent( 48 "/pprof/profile", 49 pprof.Profile, 50 ), nil 51 }, 52 ) 53 54 RegisterWebAgent( 55 func(*core.Context) (WebAgent, error) { 56 return NewDummyWebAgent( 57 "/pprof/symbol", 58 pprof.Symbol, 59 ), nil 60 }, 61 ) 62 63 RegisterWebAgent( 64 func(*core.Context) (WebAgent, error) { 65 return NewDummyWebAgent( 66 "/pprof/trace", 67 pprof.Trace, 68 ), nil 69 }, 70 ) 71 }