From 2fa91450df792689c42bd52f98ffdacee99ace91 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Thu, 30 Nov 2017 17:14:18 +0100 Subject: dashboard/app: add manager monitoring Make it possible to monitor health and operation of all managers from dashboard. 1. Notify dashboard about internal syz-ci errors (currently we don't know when/if they happen). 2. Send statistics from managers to dashboard. --- dashboard/app/handler.go | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'dashboard/app/handler.go') diff --git a/dashboard/app/handler.go b/dashboard/app/handler.go index 431261ff2..21fe67e36 100644 --- a/dashboard/app/handler.go +++ b/dashboard/app/handler.go @@ -68,6 +68,26 @@ func formatTime(t time.Time) string { return t.Format("Jan 02 15:04") } +func formatClock(t time.Time) string { + if t.IsZero() { + return "" + } + return t.Format("15:04") +} + +func formatDuration(d time.Duration) string { + if d == 0 { + return "" + } + days := int(d / (24 * time.Hour)) + hours := int(d / time.Hour % 24) + mins := int(d / time.Minute % 60) + if days != 0 { + return fmt.Sprintf("%vd%vh", days, hours) + } + return fmt.Sprintf("%vh%vm", hours, mins) +} + func formatReproLevel(l dashapi.ReproLevel) string { switch l { case ReproLevelSyz: @@ -84,6 +104,8 @@ var ( templateFuncs = template.FuncMap{ "formatTime": formatTime, + "formatClock": formatClock, + "formatDuration": formatDuration, "formatReproLevel": formatReproLevel, } ) -- cgit mrf-deployment