summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/watchdog
diff options
context:
space:
mode:
authorMichael Pratt <mpratt@google.com>2020-06-03 11:33:39 -0700
committergVisor bot <gvisor-bot@google.com>2020-06-03 11:37:10 -0700
commitb2e2a081a8a180764677111ae3c0b6179be81d31 (patch)
treeb5017081fd26d332118bdf3275d42edc5440011e /pkg/sentry/watchdog
parentfa9c9055053172ba8653c9543e4195e0207c7543 (diff)
Add metric for startup watchdog timeout
PiperOrigin-RevId: 314570894
Diffstat (limited to 'pkg/sentry/watchdog')
-rw-r--r--pkg/sentry/watchdog/watchdog.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/pkg/sentry/watchdog/watchdog.go b/pkg/sentry/watchdog/watchdog.go
index 26ce1077f..e2894f9f5 100644
--- a/pkg/sentry/watchdog/watchdog.go
+++ b/pkg/sentry/watchdog/watchdog.go
@@ -77,7 +77,10 @@ var DefaultOpts = Opts{
// trigger it.
const descheduleThreshold = 1 * time.Second
-var stuckTasks = metric.MustCreateNewUint64Metric("/watchdog/stuck_tasks_detected", true /* sync */, "Cumulative count of stuck tasks detected")
+var (
+ stuckStartup = metric.MustCreateNewUint64Metric("/watchdog/stuck_startup_detected", true /* sync */, "Incremented once on startup watchdog timeout")
+ stuckTasks = metric.MustCreateNewUint64Metric("/watchdog/stuck_tasks_detected", true /* sync */, "Cumulative count of stuck tasks detected")
+)
// Amount of time to wait before dumping the stack to the log again when the same task(s) remains stuck.
var stackDumpSameTaskPeriod = time.Minute
@@ -220,6 +223,9 @@ func (w *Watchdog) waitForStart() {
// We are fine.
return
}
+
+ stuckStartup.Increment()
+
var buf bytes.Buffer
buf.WriteString(fmt.Sprintf("Watchdog.Start() not called within %s", w.StartupTimeout))
w.doAction(w.StartupTimeoutAction, false, &buf)