diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2017-11-30 17:14:18 +0100 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2017-12-01 13:58:11 +0100 |
| commit | 2fa91450df792689c42bd52f98ffdacee99ace91 (patch) | |
| tree | 6bac47c9c556725b596af31c0212d57fc6157575 /dashboard/app/handler.go | |
| parent | 5683420f11c9eb812a57f2c5786b38015a652fa0 (diff) | |
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.
Diffstat (limited to 'dashboard/app/handler.go')
| -rw-r--r-- | dashboard/app/handler.go | 22 |
1 files changed, 22 insertions, 0 deletions
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, } ) |
