aboutsummaryrefslogtreecommitdiffstats
path: root/syz-cluster/pkg
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/pkg
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/pkg')
-rw-r--r--syz-cluster/pkg/db/stats_repo.go14
-rw-r--r--syz-cluster/pkg/db/stats_repo_test.go2
2 files changed, 16 insertions, 0 deletions
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}