Skip to content

Commit

Permalink
Add Uptime metric (vitessio#12712)
Browse files Browse the repository at this point in the history
* Add `Uptime` metric to `vtgate`+`vttablet`

Signed-off-by: Tim Vaillancourt <[email protected]>

* move to go/vt/servenv/status.go

Signed-off-by: Tim Vaillancourt <[email protected]>

* Use nanoseconds for uptime

Signed-off-by: Tim Vaillancourt <[email protected]>

* Move Uptime metrics to servenv.go, remove dupe start time.Time

Signed-off-by: Tim Vaillancourt <[email protected]>

* Use serverStart time.Time

Signed-off-by: Tim Vaillancourt <[email protected]>

---------

Signed-off-by: Tim Vaillancourt <[email protected]>
  • Loading branch information
timvaillancourt committed Jun 28, 2023
1 parent c322ded commit 40a39f5
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions go/vt/servenv/servenv.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,11 @@ func Init() {
return int64(time.Since(serverStart).Nanoseconds())
})

// Uptime metric
_ = stats.NewGaugeFunc("Uptime", "Uptime in nanoseconds", func() int64 {
return int64(time.Since(serverStart).Nanoseconds())
})

// Ignore SIGPIPE if specified
// The Go runtime catches SIGPIPE for us on all fds except stdout/stderr
// See https://golang.org/pkg/os/signal/#hdr-SIGPIPE
Expand Down

0 comments on commit 40a39f5

Please sign in to comment.