Skip to content

Commit 7951290

Browse files
committed
syz-cluster: improve the status distribution graph
Display the share of sessions that have failed and skipped tests.
1 parent 8c32f0f commit 7951290

File tree

2 files changed

+36
-13
lines changed

2 files changed

+36
-13
lines changed

syz-cluster/dashboard/templates/graphs.html

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ <h2 class="h4">Status Distribution (weekly)</h2>
5656

5757
const distributionData = [
5858
{{range .Distribution}}
59-
[new Date({{.Date.Format "2006-01-02"}}), {{.Finished}}, {{.Skipped}}],
59+
[new Date({{.Date.Format "2006-01-02"}}), {{.Finished}}, {{.Skipped}}, {{.WithFailedSteps}}, {{.WithSkippedSteps}}],
6060
{{end}}
6161
];
6262

@@ -94,6 +94,8 @@ <h2 class="h4">Status Distribution (weekly)</h2>
9494
data.addColumn('date', 'Date');
9595
data.addColumn('number', 'Processed');
9696
data.addColumn('number', 'Skipped');
97+
data.addColumn('number', 'Some steps failed');
98+
data.addColumn('number', 'Some steps skipped');
9799
data.addRows(distributionData);
98100
const options = {
99101
isStacked: 'percent',
@@ -103,7 +105,7 @@ <h2 class="h4">Status Distribution (weekly)</h2>
103105
minValue: 0,
104106
format: '#%'
105107
},
106-
colors: ['#28a745', '#ffc107'],
108+
colors: ['#28a745', '#ffc107', '#ffcccb', '#d5f0c0'],
107109
areaOpacity: 0.8
108110
};
109111
const chart = new google.visualization.AreaChart(document.getElementById('distribution_chart_div'));

syz-cluster/pkg/db/stats_repo.go

Lines changed: 32 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -53,24 +53,45 @@ ORDER BY Date`,
5353
}
5454

5555
type StatusPerWeek struct {
56-
Date time.Time `spanner:"Date"`
57-
Finished int64 `spanner:"Finished"`
58-
Skipped int64 `spanner:"Skipped"`
56+
Date time.Time `spanner:"Date"`
57+
Total int64 `spanner:"Total"`
58+
Finished int64
59+
Skipped int64 `spanner:"Skipped"`
60+
WithFailedSteps int64 `spanner:"WithFailedSteps"`
61+
WithSkippedSteps int64 `spanner:"WithSkippedSteps"`
5962
}
6063

6164
func (repo *StatsRepository) SessionStatusPerWeek(ctx context.Context) (
6265
[]*StatusPerWeek, error) {
63-
return readEntities[StatusPerWeek](ctx, repo.client.Single(), spanner.Statement{
64-
SQL: `SELECT
65-
TIMESTAMP_TRUNC(Sessions.FinishedAt, WEEK) as Date,
66-
COUNTIF(Sessions.SkipReason IS NULL) as Finished,
67-
COUNTIF(Sessions.SkipReason IS NOT NULL) as Skipped
68-
FROM Series
69-
JOIN Sessions ON Sessions.ID = Series.LatestSessionID
70-
WHERE FinishedAt IS NOT NULL
66+
rows, err := readEntities[StatusPerWeek](ctx, repo.client.Single(), spanner.Statement{
67+
SQL: `WITH SessionTestAggregates AS (
68+
SELECT
69+
SessionID,
70+
COUNTIF(Result = 'failed') > 0 AS HasFailedSteps,
71+
COUNTIF(Result = 'skipped') > 0 AS HasSkippedSteps
72+
FROM SessionTests
73+
GROUP BY SessionID
74+
)
75+
SELECT
76+
TIMESTAMP_TRUNC(Sessions.FinishedAt, WEEK) AS Date,
77+
COUNT(Sessions.ID) AS Total,
78+
COUNTIF(Sessions.SkipReason IS NOT NULL) AS Skipped,
79+
COUNTIF(sta.HasFailedSteps) AS WithFailedSteps,
80+
COUNTIF(sta.HasSkippedSteps AND NOT sta.HasFailedSteps) AS WithSkippedSteps
81+
FROM Sessions
82+
LEFT JOIN
83+
SessionTestAggregates AS sta ON Sessions.ID = sta.SessionID
84+
WHERE Sessions.FinishedAt IS NOT NULL
7185
GROUP BY Date
7286
ORDER BY Date`,
7387
})
88+
if err != nil {
89+
return nil, err
90+
}
91+
for _, row := range rows {
92+
row.Finished = row.Total - row.Skipped - row.WithFailedSteps - row.WithSkippedSteps
93+
}
94+
return rows, err
7495
}
7596

7697
type DelayPerWeek struct {

0 commit comments

Comments
 (0)