aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2017-12-01 15:16:13 +0100
committerDmitry Vyukov <dvyukov@google.com>2017-12-01 17:13:23 +0100
commit948edf8055be2275a7c051e49cd38223517f98be (patch)
tree228f9ff429fa7106742dcef6eb4179bb04f6984b
parente0375d3ee6513d1f62873c119bc2860ba8adab07 (diff)
dashboard/app: cosmetic changes to manager stats
-rw-r--r--dashboard/app/api.go4
-rw-r--r--dashboard/app/handler.go30
-rw-r--r--dashboard/app/main.go4
-rw-r--r--dashboard/app/main.html81
-rw-r--r--dashboard/app/static/style.css19
5 files changed, 76 insertions, 62 deletions
diff --git a/dashboard/app/api.go b/dashboard/app/api.go
index ef1f344fd..cab952561 100644
--- a/dashboard/app/api.go
+++ b/dashboard/app/api.go
@@ -573,7 +573,7 @@ func apiReportFailedRepro(c context.Context, ns string, r *http.Request) (interf
return nil, err
}
if bug == nil {
- return nil, fmt.Errorf("can't find bug for this crash")
+ return nil, fmt.Errorf("%v: can't find bug for crash %q", ns, req.Title)
}
tx := func(c context.Context) error {
bug := new(Bug)
@@ -613,7 +613,7 @@ func apiNeedRepro(c context.Context, ns string, r *http.Request) (interface{}, e
return nil, err
}
if bug == nil {
- return nil, fmt.Errorf("can't find bug for this crash")
+ return nil, fmt.Errorf("%v: can't find bug for crash %q", ns, req.Title)
}
resp := &dashapi.NeedReproResp{
NeedRepro: needRepro(bug),
diff --git a/dashboard/app/handler.go b/dashboard/app/handler.go
index ef8cec133..91d0210c7 100644
--- a/dashboard/app/handler.go
+++ b/dashboard/app/handler.go
@@ -92,10 +92,25 @@ func formatDuration(d time.Duration) string {
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)
+ if days >= 10 {
+ return fmt.Sprintf("%vd", days)
+ } else if days != 0 {
+ return fmt.Sprintf("%vd%02vh", days, hours)
+ } else if hours != 0 {
+ return fmt.Sprintf("%vh%02vm", hours, mins)
}
- return fmt.Sprintf("%vh%vm", hours, mins)
+ return fmt.Sprintf("%vm", mins)
+}
+
+func formatLateness(now, t time.Time) string {
+ if t.IsZero() {
+ return "never"
+ }
+ d := now.Sub(t)
+ if d < 5*time.Minute {
+ return "now"
+ }
+ return formatDuration(d)
}
func formatReproLevel(l dashapi.ReproLevel) string {
@@ -109,6 +124,13 @@ func formatReproLevel(l dashapi.ReproLevel) string {
}
}
+func formatStat(v int64) string {
+ if v == 0 {
+ return ""
+ }
+ return fmt.Sprint(v)
+}
+
var (
templates = template.Must(template.New("").Funcs(templateFuncs).ParseGlob("*.html"))
@@ -116,6 +138,8 @@ var (
"formatTime": formatTime,
"formatClock": formatClock,
"formatDuration": formatDuration,
+ "formatLateness": formatLateness,
"formatReproLevel": formatReproLevel,
+ "formatStat": formatStat,
}
)
diff --git a/dashboard/app/main.go b/dashboard/app/main.go
index cb66a28ba..70e5f05b6 100644
--- a/dashboard/app/main.go
+++ b/dashboard/app/main.go
@@ -28,6 +28,7 @@ func init() {
type uiMain struct {
Header *uiHeader
+ Now time.Time
Log []byte
Managers []*uiManager
Jobs []*uiJob
@@ -73,6 +74,7 @@ type uiBug struct {
Namespace string
Title string
NumCrashes int64
+ NumCrashesBad bool
FirstTime time.Time
LastTime time.Time
ReproLevel dashapi.ReproLevel
@@ -144,6 +146,7 @@ func handleMain(c context.Context, w http.ResponseWriter, r *http.Request) error
}
data := &uiMain{
Header: h,
+ Now: timeNow(c),
Log: errorLog,
Managers: managers,
Jobs: jobs,
@@ -259,6 +262,7 @@ func createUIBug(c context.Context, bug *Bug, state *ReportingState, managers []
Namespace: bug.Namespace,
Title: bug.displayTitle(),
NumCrashes: bug.NumCrashes,
+ NumCrashesBad: bug.NumCrashes >= 10000 && timeNow(c).Sub(bug.LastTime) < 24*time.Hour,
FirstTime: bug.FirstTime,
LastTime: bug.LastTime,
ReproLevel: bug.ReproLevel,
diff --git a/dashboard/app/main.html b/dashboard/app/main.html
index 7a6e8ae05..6a9c84f75 100644
--- a/dashboard/app/main.html
+++ b/dashboard/app/main.html
@@ -1,27 +1,3 @@
-{{define "bug_table"}}
- <table class="list_table">
- <caption>{{.Namespace}} ({{len $.Bugs}}):</caption>
- <tr>
- <th>Title</th>
- <th>Count</th>
- <th>Repro</th>
- <th>Last</th>
- <th>Status</th>
- <th>Patched</th>
- </tr>
- {{range $b := $.Bugs}}
- <tr>
- <td class="title"><a href="{{$b.Link}}">{{$b.Title}}</a></td>
- <td class="count">{{$b.NumCrashes}}</td>
- <td class="repro">{{formatReproLevel $b.ReproLevel}}</td>
- <td class="time">{{formatTime $b.LastTime}}</td>
- <td class="status">{{if $b.Link}}<a href="{{$b.ExternalLink}}">{{$b.Status}}</a>{{else}}{{$b.Status}}{{end}}</td>
- <td class="patched" title="{{$b.Commits}}">{{if $b.Commits}}{{len $b.PatchedOn}}/{{len $b.MissingOn}}{{end}}</td>
- </tr>
- {{end}}
- </table>
-{{end}}
-
<!doctype html>
<html>
<head>
@@ -45,38 +21,30 @@
<th>Name</th>
<th>Last Active</th>
<th>Current Build</th>
- <th>Failed Build</th>
- <th>Today: Uptime</th>
- <th>Fuzzing Time</th>
+ <th>Current Uptime</th>
+ <th>Today: Fuzzing Time</th>
<th>Corpus</th>
<th>Coverage</th>
<th>Crashes</th>
<th>Execs</th>
+ <th>Failed Build</th>
</tr>
{{range $mgr := $.Managers}}
<tr>
<td>{{$mgr.Namespace}}/{{$mgr.Name}}</td>
- {{if $mgr.LastActiveBad}}
- <td style="color:#f00">{{formatTime $mgr.LastActive}}</td>
- {{else}}
- <td>{{formatClock $mgr.LastActive}}</td>
- {{end}}
+ <td class="stat {{if $mgr.LastActiveBad}}bad{{end}}">{{formatLateness $.Now $mgr.LastActive}}</td>
{{if $mgr.CurrentBuild}}
- <td title="{{$mgr.CurrentBuild.KernelRepo}}/{{$mgr.CurrentBuild.KernelBranch}}/{{$mgr.CurrentBuild.KernelCommit}} (syzkaller {{$mgr.CurrentBuild.SyzkallerCommit}})">{{formatTime $mgr.CurrentBuild.Time}}</td>
- {{else}}
- <td></td>
- {{end}}
- {{if $mgr.FailedBuildBugLink}}
- <td><a href="{{$mgr.FailedBuildBugLink}}" style="color:#f00">failed</a></td>
+ <td class="stat" title="{{$mgr.CurrentBuild.KernelRepo}}/{{$mgr.CurrentBuild.KernelBranch}}/{{$mgr.CurrentBuild.KernelCommit}} (syzkaller {{$mgr.CurrentBuild.SyzkallerCommit}})">{{formatLateness $.Now $mgr.CurrentBuild.Time}}</td>
{{else}}
<td></td>
{{end}}
- <td>{{formatDuration $mgr.CurrentUpTime}}</td>
- <td>{{formatDuration $mgr.TotalFuzzingTime}}</td>
- <td>{{$mgr.MaxCorpus}}</td>
- <td>{{$mgr.MaxCover}}</td>
- <td>{{$mgr.TotalCrashes}}</td>
- <td>{{$mgr.TotalExecs}}</td>
+ <td class="stat">{{formatDuration $mgr.CurrentUpTime}}</td>
+ <td class="stat">{{formatDuration $mgr.TotalFuzzingTime}}</td>
+ <td class="stat">{{formatStat $mgr.MaxCorpus}}</td>
+ <td class="stat">{{formatStat $mgr.MaxCover}}</td>
+ <td class="stat">{{formatStat $mgr.TotalCrashes}}</td>
+ <td class="stat">{{formatStat $mgr.TotalExecs}}</td>
+ <td class="stat">{{if $mgr.FailedBuildBugLink}}<a href="{{$mgr.FailedBuildBugLink}}" class="bad">bug</a>{{end}}</td>
</tr>
{{end}}
</table>
@@ -132,8 +100,29 @@
</table>
<br><br>
- {{range $g := $.BugGroups}}
- {{template "bug_table" $g}} <br>
+ {{range $group := $.BugGroups}}
+ <table class="list_table">
+ <caption>{{.Namespace}} ({{len $group.Bugs}}):</caption>
+ <tr>
+ <th>Title</th>
+ <th>Count</th>
+ <th>Repro</th>
+ <th>Last</th>
+ <th>Status</th>
+ <th>Patched</th>
+ </tr>
+ {{range $b := $group.Bugs}}
+ <tr>
+ <td class="title"><a href="{{$b.Link}}">{{$b.Title}}</a></td>
+ <td class="stat {{if $b.NumCrashesBad}}bad{{end}}">{{$b.NumCrashes}}</td>
+ <td class="stat">{{formatReproLevel $b.ReproLevel}}</td>
+ <td class="stat">{{formatLateness $.Now $b.LastTime}}</td>
+ <td class="status">{{if $b.Link}}<a href="{{$b.ExternalLink}}">{{$b.Status}}</a>{{else}}{{$b.Status}}{{end}}</td>
+ <td class="patched" title="{{$b.Commits}}">{{if $b.Commits}}{{len $b.PatchedOn}}/{{len $b.MissingOn}}{{end}}</td>
+ </tr>
+ {{end}}
+ </table>
+ <br><br>
{{end}}
</body>
</html>
diff --git a/dashboard/app/static/style.css b/dashboard/app/static/style.css
index 98bf1913b..5ef180b99 100644
--- a/dashboard/app/static/style.css
+++ b/dashboard/app/static/style.css
@@ -77,10 +77,6 @@ table td, table th {
max-width: 400pt;
}
-.list_table .count {
- text-align: right;
-}
-
.list_table .tag {
font-family: monospace;
font-size: 8pt;
@@ -112,13 +108,14 @@ table td, table th {
max-width: 300pt;
}
-.button {
- color: #222;
- border: 1px solid #375EAB;
- background: #E0EBF5;
- border-radius: 3px;
- cursor: pointer;
- margin-left: 10px;
+.list_table .stat {
+ font-family: monospace;
+ text-align: right;
+}
+
+.bad {
+ color: #f00;
+ font-weight: bold;
}
textarea {