aboutsummaryrefslogtreecommitdiffstats
path: root/syz-cluster
diff options
context:
space:
mode:
authorAleksandr Nogikh <nogikh@google.com>2025-08-19 12:10:32 +0200
committerAleksandr Nogikh <nogikh@google.com>2025-08-19 15:02:37 +0000
commit795129097e7698798d759932c65f298b6110be22 (patch)
tree16c482bf74271919497d901fe2f4f0fb27a764f2 /syz-cluster
parent8c32f0ff1ce7f5076910229181d6f43a194531e4 (diff)
syz-cluster: improve the status distribution graph
Display the share of sessions that have failed and skipped tests.
Diffstat (limited to 'syz-cluster')
-rw-r--r--syz-cluster/dashboard/templates/graphs.html6
-rw-r--r--syz-cluster/pkg/db/stats_repo.go43
2 files changed, 36 insertions, 13 deletions
diff --git a/syz-cluster/dashboard/templates/graphs.html b/syz-cluster/dashboard/templates/graphs.html
index 747776916..0972ae6df 100644
--- a/syz-cluster/dashboard/templates/graphs.html
+++ b/syz-cluster/dashboard/templates/graphs.html
@@ -56,7 +56,7 @@
const distributionData = [
{{range .Distribution}}
- [new Date({{.Date.Format "2006-01-02"}}), {{.Finished}}, {{.Skipped}}],
+ [new Date({{.Date.Format "2006-01-02"}}), {{.Finished}}, {{.Skipped}}, {{.WithFailedSteps}}, {{.WithSkippedSteps}}],
{{end}}
];
@@ -94,6 +94,8 @@
data.addColumn('date', 'Date');
data.addColumn('number', 'Processed');
data.addColumn('number', 'Skipped');
+ data.addColumn('number', 'Some steps failed');
+ data.addColumn('number', 'Some steps skipped');
data.addRows(distributionData);
const options = {
isStacked: 'percent',
@@ -103,7 +105,7 @@
minValue: 0,
format: '#%'
},
- colors: ['#28a745', '#ffc107'],
+ colors: ['#28a745', '#ffc107', '#ffcccb', '#d5f0c0'],
areaOpacity: 0.8
};
const chart = new google.visualization.AreaChart(document.getElementById('distribution_chart_div'));
diff --git a/syz-cluster/pkg/db/stats_repo.go b/syz-cluster/pkg/db/stats_repo.go
index d881cb243..e96d6b23b 100644
--- a/syz-cluster/pkg/db/stats_repo.go
+++ b/syz-cluster/pkg/db/stats_repo.go
@@ -53,24 +53,45 @@ ORDER BY Date`,
}
type StatusPerWeek struct {
- Date time.Time `spanner:"Date"`
- Finished int64 `spanner:"Finished"`
- Skipped int64 `spanner:"Skipped"`
+ Date time.Time `spanner:"Date"`
+ Total int64 `spanner:"Total"`
+ Finished int64
+ Skipped int64 `spanner:"Skipped"`
+ WithFailedSteps int64 `spanner:"WithFailedSteps"`
+ WithSkippedSteps int64 `spanner:"WithSkippedSteps"`
}
func (repo *StatsRepository) SessionStatusPerWeek(ctx context.Context) (
[]*StatusPerWeek, error) {
- return readEntities[StatusPerWeek](ctx, repo.client.Single(), spanner.Statement{
- SQL: `SELECT
- TIMESTAMP_TRUNC(Sessions.FinishedAt, WEEK) as Date,
- COUNTIF(Sessions.SkipReason IS NULL) as Finished,
- COUNTIF(Sessions.SkipReason IS NOT NULL) as Skipped
-FROM Series
-JOIN Sessions ON Sessions.ID = Series.LatestSessionID
-WHERE FinishedAt IS NOT NULL
+ rows, err := readEntities[StatusPerWeek](ctx, repo.client.Single(), spanner.Statement{
+ SQL: `WITH SessionTestAggregates AS (
+ SELECT
+ SessionID,
+ COUNTIF(Result = 'failed') > 0 AS HasFailedSteps,
+ COUNTIF(Result = 'skipped') > 0 AS HasSkippedSteps
+ FROM SessionTests
+ GROUP BY SessionID
+)
+SELECT
+ TIMESTAMP_TRUNC(Sessions.FinishedAt, WEEK) AS Date,
+ COUNT(Sessions.ID) AS Total,
+ COUNTIF(Sessions.SkipReason IS NOT NULL) AS Skipped,
+ COUNTIF(sta.HasFailedSteps) AS WithFailedSteps,
+ COUNTIF(sta.HasSkippedSteps AND NOT sta.HasFailedSteps) AS WithSkippedSteps
+FROM Sessions
+LEFT JOIN
+ SessionTestAggregates AS sta ON Sessions.ID = sta.SessionID
+WHERE Sessions.FinishedAt IS NOT NULL
GROUP BY Date
ORDER BY Date`,
})
+ if err != nil {
+ return nil, err
+ }
+ for _, row := range rows {
+ row.Finished = row.Total - row.Skipped - row.WithFailedSteps - row.WithSkippedSteps
+ }
+ return rows, err
}
type DelayPerWeek struct {