github.com/awesome-flow/flow@v0.0.3-0.20190918184116-508d75d68a2c/web/app/agent/expvar.go (about) 1 package agent 2 3 import ( 4 "expvar" 5 "net/http" 6 7 core "github.com/awesome-flow/flow/pkg/corev1alpha1" 8 ) 9 10 type ExpvarWebAgent struct { 11 path string 12 } 13 14 func NewExpvarWebAgent(path string) *ExpvarWebAgent { 15 return &ExpvarWebAgent{path: path} 16 } 17 18 func (eva *ExpvarWebAgent) GetPath() string { 19 return eva.path 20 } 21 22 func (eva *ExpvarWebAgent) GetHandler() http.Handler { 23 return expvar.Handler() 24 } 25 26 func (eva *ExpvarWebAgent) Start() error { 27 return nil 28 } 29 30 func (eva *ExpvarWebAgent) Stop() error { 31 return nil 32 } 33 34 func init() { 35 RegisterWebAgent( 36 func(ctx *core.Context) (WebAgent, error) { 37 return NewExpvarWebAgent("/expvar"), nil 38 }, 39 ) 40 }