tsweb: add vars for unix process start time and version

To be scraped in the Go expvar JSON format, as a string is involved.

For a future tool to record when processes restarted exactly, and at
what version.

Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
pull/1919/head
Brad Fitzpatrick 3 years ago committed by Brad Fitzpatrick
parent 246fa67e56
commit 51976ab3a2

@ -28,9 +28,12 @@ import (
"tailscale.com/metrics"
"tailscale.com/net/tsaddr"
"tailscale.com/types/logger"
"tailscale.com/version"
)
func init() {
expvar.Publish("process_start_unix_time", expvar.Func(func() interface{} { return timeStart.Unix() }))
expvar.Publish("version", expvar.Func(func() interface{} { return version.Long }))
expvar.Publish("counter_uptime_sec", expvar.Func(func() interface{} { return int64(Uptime().Seconds()) }))
expvar.Publish("gauge_goroutines", expvar.Func(func() interface{} { return runtime.NumGoroutine() }))
}

Loading…
Cancel
Save