aboutsummaryrefslogtreecommitdiffstats
path: root/syz-cluster
diff options
context:
space:
mode:
authorAleksandr Nogikh <nogikh@google.com>2025-10-09 13:07:14 +0200
committerAleksandr Nogikh <nogikh@google.com>2025-10-17 07:26:38 +0000
commit03f955c333876a30a020002473aa2bda3c123681 (patch)
tree7f16e45e710db7eea01ee6d109dd17f6d67717bf /syz-cluster
parente18aa5057febfc3f9f61c8755234e361528def0e (diff)
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.
Diffstat (limited to 'syz-cluster')
-rw-r--r--syz-cluster/dashboard/handler.go5
-rw-r--r--syz-cluster/dashboard/templates/graphs.html16
-rw-r--r--syz-cluster/pkg/db/stats_repo.go14
-rw-r--r--syz-cluster/pkg/db/stats_repo_test.go2
4 files changed, 37 insertions, 0 deletions
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
@@ -19,6 +19,15 @@
<hr class="my-4">
<div class="chart-wrapper mb-4">
+ <h2 class="h4">Reports (weekly)</h2>
+ <p class="text-muted small">How many reports with findings have been published.</p>
+ <div id="reports_chart_div" style="width: 100%; height: 400px;"></div>
+ <p class="text-muted small">Click and drag to zoom into a time range. Right-click to reset.</p>
+ </div>
+
+ <hr class="my-4">
+
+ <div class="chart-wrapper mb-4">
<h2 class="h4">Wait Time before Fuzzing (avg hours, weekly)</h2>
<p class="text-muted small">How many hours have passed since the moment the series was published and the moment we started fuzzing it.</p>
<div id="avg_wait_chart_div" style="width: 100%; height: 400px;"></div>
@@ -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}