expvarmon/expvars.go

31 lines
517 B
Go
Raw Normal View History

2015-04-21 17:51:01 +08:00
package main
import (
2015-05-01 05:47:11 +08:00
//"io"
2015-04-21 17:51:01 +08:00
"runtime"
)
const ExpvarsUrl = "/debug/vars"
2015-04-25 20:54:17 +08:00
// ExpvarsSource implements Source interface for retrieving Expvars.
2015-04-21 17:51:01 +08:00
type ExpvarsSource struct {
Ports []string
}
type Expvars map[string]Expvar
type Expvar struct {
2015-04-25 20:54:17 +08:00
MemStats *runtime.MemStats `json:"memstats"`
Cmdline []string `json:"cmdline"`
2015-04-21 17:51:01 +08:00
2015-05-01 05:47:11 +08:00
Extra map[string]interface{} `json:"-"`
2015-04-21 17:51:01 +08:00
Err error `json:"-,omitempty"`
}
func NewExpvarsSource(ports []string) *ExpvarsSource {
return &ExpvarsSource{
Ports: ports,
}
}