aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAleksandr Nogikh <nogikh@google.com>2023-08-22 17:05:19 +0200
committerAleksandr Nogikh <nogikh@google.com>2023-08-23 14:34:34 +0000
commit4d7ae7ab1c3ef41cc0e71fb19799dcec94213101 (patch)
tree147ae3183d0f8ad252c023b560e6d7904e1c2f6b
parent069a095c22ad32ee24657ba0993e69c62398d3d2 (diff)
dashboard: display historically open bugs in Kernel Health
Currently we remove all invalidated and deduplicated bugs, which skews the graph over time - many of the currently open bugs will be invalidated, too, and disappear from the graph later. Let's be more historically correct and display the actual number of open bugs at every moment in history.
-rw-r--r--dashboard/app/graphs.go29
1 files changed, 22 insertions, 7 deletions
diff --git a/dashboard/app/graphs.go b/dashboard/app/graphs.go
index b5b254f5f..74d982eb0 100644
--- a/dashboard/app/graphs.go
+++ b/dashboard/app/graphs.go
@@ -168,11 +168,16 @@ func loadGraphBugs(c context.Context, ns string) ([]*Bug, error) {
fixes := make(map[string]bool)
lastReporting := config.Namespaces[ns].lastActiveReporting()
for _, bug := range bugs {
- if bug.Status >= BugStatusInvalid {
- continue
- }
- if bug.Status == BugStatusOpen && bug.Reporting[lastReporting].Reported.IsZero() {
- continue
+ if bug.Reporting[lastReporting].Reported.IsZero() {
+ if bug.Status == BugStatusOpen {
+ // These bugs are not released yet.
+ continue
+ }
+ bugReporting := lastReportedReporting(bug)
+ if bugReporting == nil || bugReporting.Auto && bug.Status == BugStatusInvalid {
+ // These bugs were auto-obsoleted before getting released.
+ continue
+ }
}
dup := false
for _, com := range bug.Commits {
@@ -194,9 +199,11 @@ func createBugsGraph(c context.Context, bugs []*Bug) *uiGraph {
type BugStats struct {
Opened int
Fixed int
+ Closed int
TotalReported int
TotalOpen int
TotalFixed int
+ TotalClosed int
}
const timeWeek = 30 * 24 * time.Hour
now := timeNow(c)
@@ -220,9 +227,13 @@ func createBugsGraph(c context.Context, bugs []*Bug) *uiGraph {
for _, bug := range bugs {
bugStatsFor(bug.FirstTime).Opened++
if !bug.Closed.IsZero() {
- bugStatsFor(bug.Closed).Fixed++
+ if bug.Status == BugStatusFixed {
+ bugStatsFor(bug.Closed).Fixed++
+ }
+ bugStatsFor(bug.Closed).Closed++
} else if len(bug.Commits) != 0 {
bugStatsFor(now).Fixed++
+ bugStatsFor(now).Closed++
}
}
var stats []BugStats
@@ -234,7 +245,8 @@ func createBugsGraph(c context.Context, bugs []*Bug) *uiGraph {
}
bs.TotalReported = prev.TotalReported + bs.Opened
bs.TotalFixed = prev.TotalFixed + bs.Fixed
- bs.TotalOpen = bs.TotalReported - bs.TotalFixed
+ bs.TotalClosed = prev.TotalClosed + bs.Closed
+ bs.TotalOpen = bs.TotalReported - bs.TotalClosed
stats = append(stats, bs)
prev = bs
}
@@ -261,6 +273,9 @@ func createBugLifetimes(c context.Context, bugs []*Bug, causeBisects map[string]
// TODO: this is not the time when it was reported to the final reporting.
Reported: bug.FirstTime,
}
+ if bug.Status >= BugStatusInvalid {
+ continue
+ }
fixed := bug.FixTime
if fixed.IsZero() || bug.Status == BugStatusFixed && bug.Closed.Before(fixed) {
fixed = bug.Closed