mirror of
https://github.com/tailscale/tailscale.git
synced 2024-11-29 04:55:31 +00:00
tsweb: register expvars once at startup.
Signed-off-by: David Anderson <danderson@tailscale.com>
This commit is contained in:
parent
9337826011
commit
72343fbbec
@ -29,6 +29,11 @@
|
|||||||
"tailscale.com/types/logger"
|
"tailscale.com/types/logger"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
expvar.Publish("counter_uptime_sec", expvar.Func(func() interface{} { return int64(Uptime().Seconds()) }))
|
||||||
|
expvar.Publish("gauge_goroutines", expvar.Func(func() interface{} { return runtime.NumGoroutine() }))
|
||||||
|
}
|
||||||
|
|
||||||
// DevMode controls whether extra output in shown, for when the binary is being run in dev mode.
|
// DevMode controls whether extra output in shown, for when the binary is being run in dev mode.
|
||||||
var DevMode bool
|
var DevMode bool
|
||||||
|
|
||||||
@ -41,8 +46,6 @@ func NewMux(debugHandler http.Handler) *http.ServeMux {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func registerCommonDebug(mux *http.ServeMux) {
|
func registerCommonDebug(mux *http.ServeMux) {
|
||||||
expvar.Publish("counter_uptime_sec", expvar.Func(func() interface{} { return int64(Uptime().Seconds()) }))
|
|
||||||
expvar.Publish("gauge_goroutines", expvar.Func(func() interface{} { return runtime.NumGoroutine() }))
|
|
||||||
mux.Handle("/debug/pprof/", Protected(http.DefaultServeMux)) // to net/http/pprof
|
mux.Handle("/debug/pprof/", Protected(http.DefaultServeMux)) // to net/http/pprof
|
||||||
mux.Handle("/debug/vars", Protected(http.DefaultServeMux)) // to expvar
|
mux.Handle("/debug/vars", Protected(http.DefaultServeMux)) // to expvar
|
||||||
mux.Handle("/debug/varz", Protected(http.HandlerFunc(VarzHandler)))
|
mux.Handle("/debug/varz", Protected(http.HandlerFunc(VarzHandler)))
|
||||||
|
Loading…
Reference in New Issue
Block a user