init: log a metric when service startup fails
Today, if daisydog fails to start up properly, it gets logged as respawn
too fast failure by upstart, and that's it. Add a metric to track this
better over all devices so we can see if we need to add more logic here
in the future.
BUG=chromium:673501
TEST=start up logged the metric
CQ-DEPEND=CL:418836
Change-Id: I5f317c408581b4892a1c3d61a58f2d79f66fa97a
Reviewed-on: https://chromium-review.googlesource.com/420363
Commit-Ready: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Luigi Semenzato <semenzato@chromium.org>
diff --git a/daisydog.conf b/daisydog.conf
index df1640c..70d712c 100644
--- a/daisydog.conf
+++ b/daisydog.conf
@@ -28,6 +28,8 @@
# exist as in a VM), and exit (which halts the init script entirely).
logger -t "${UPSTART_JOB}" -p daemon.error \
"error: watchdog startup failed: ${output}"
+ # Log a metric so we can keep tabs on when this happens in real life.
+ metrics_client -v Watchdog.StartupFailed
exit 1
fi