From 03f955c333876a30a020002473aa2bda3c123681 Mon Sep 17 00:00:00 2001 From: Aleksandr Nogikh Date: Thu, 9 Oct 2025 13:07:14 +0200 Subject: syz-cluster: display the reports count graph Apart from just the total number of findings (some of which may end up being non-reported), also display specifically the number of reports that have found their way to the mailing lists. --- syz-cluster/dashboard/handler.go | 5 +++++ syz-cluster/dashboard/templates/graphs.html | 16 ++++++++++++++++ syz-cluster/pkg/db/stats_repo.go | 14 ++++++++++++++ syz-cluster/pkg/db/stats_repo_test.go | 2 ++ 4 files changed, 37 insertions(+) diff --git a/syz-cluster/dashboard/handler.go b/syz-cluster/dashboard/handler.go index 2212bd959..58edd5c39 100644 --- a/syz-cluster/dashboard/handler.go +++ b/syz-cluster/dashboard/handler.go @@ -218,6 +218,7 @@ func (h *dashboardHandler) statsPage(w http.ResponseWriter, r *http.Request) err type StatsPageData struct { Processed []*db.CountPerWeek Findings []*db.CountPerWeek + Reports []*db.CountPerWeek Delay []*db.DelayPerWeek Distribution []*db.StatusPerWeek } @@ -231,6 +232,10 @@ func (h *dashboardHandler) statsPage(w http.ResponseWriter, r *http.Request) err if err != nil { return fmt.Errorf("failed to query findings data: %w", err) } + data.Reports, err = h.statsRepo.ReportsPerWeek(r.Context()) + if err != nil { + return fmt.Errorf("failed to query reports data: %w", err) + } data.Delay, err = h.statsRepo.DelayPerWeek(r.Context()) if err != nil { return fmt.Errorf("failed to query delay data: %w", err) diff --git a/syz-cluster/dashboard/templates/graphs.html b/syz-cluster/dashboard/templates/graphs.html index e972b81ca..c4da3289f 100644 --- a/syz-cluster/dashboard/templates/graphs.html +++ b/syz-cluster/dashboard/templates/graphs.html @@ -18,6 +18,15 @@
+
+

Reports (weekly)

+

How many reports with findings have been published.

+
+

Click and drag to zoom into a time range. Right-click to reset.

+
+ +
+

Wait Time before Fuzzing (avg hours, weekly)

How many hours have passed since the moment the series was published and the moment we started fuzzing it.

@@ -67,9 +76,16 @@ {{end}} ]; + const reportsData = [ + {{range .Reports}} + [new Date({{.Date.Format "2006-01-02"}}), {{.Count}}], + {{end}} + ]; + function drawAllCharts() { drawChart('processed_chart_div', processedData, '#007bff'); drawChart('findings_chart_div', findingsData, '#dc3545'); + drawChart('reports_chart_div', reportsData, '#dc3545'); drawChart('avg_wait_chart_div', delayData, 'black'); drawDistributionChart(); } diff --git a/syz-cluster/pkg/db/stats_repo.go b/syz-cluster/pkg/db/stats_repo.go index 7604df159..588945b3b 100644 --- a/syz-cluster/pkg/db/stats_repo.go +++ b/syz-cluster/pkg/db/stats_repo.go @@ -39,6 +39,20 @@ ORDER BY Date`, }) } +func (repo *StatsRepository) ReportsPerWeek(ctx context.Context) ( + []*CountPerWeek, error) { + return readEntities[CountPerWeek](ctx, repo.client.Single(), spanner.Statement{ + SQL: `SELECT + TIMESTAMP_TRUNC(SessionReports.ReportedAt, WEEK) as Date, + COUNT(*) as Count +FROM Findings +JOIN SessionReports ON SessionReports.SessionID = Findings.SessionID +WHERE SessionReports.Moderation = FALSE AND SessionReports.ReportedAt IS NOT NULL +GROUP BY Date +ORDER BY Date`, + }) +} + func (repo *StatsRepository) FindingsPerWeek(ctx context.Context) ( []*CountPerWeek, error) { return readEntities[CountPerWeek](ctx, repo.client.Single(), spanner.Statement{ diff --git a/syz-cluster/pkg/db/stats_repo_test.go b/syz-cluster/pkg/db/stats_repo_test.go index ce2b05ca9..18f774710 100644 --- a/syz-cluster/pkg/db/stats_repo_test.go +++ b/syz-cluster/pkg/db/stats_repo_test.go @@ -25,6 +25,8 @@ func TestStatsSQLs(t *testing.T) { assert.NoError(t, err) _, err = statsRepo.DelayPerWeek(ctx) assert.NoError(t, err) + _, err = statsRepo.ReportsPerWeek(ctx) + assert.NoError(t, err) } dtd := &dummyTestData{t, ctx, client} -- cgit mrf-deployment