Commit 6cf8e28
authored
Fix HUD metrics "commits red on main" showing commits gray forever (#8327)
**Impact:** HUD /metrics page
**Risk:** low
## What
Reworks the `master_commit_red` query (/metrics page, "Commits red on
main, by hour") to collapse duplicate GitHub job ids into a single
per-job state before deciding whether a commit is pending, so abandoned
placeholder jobs no longer keep a commit gray indefinitely.
## Why
GitHub Actions sometimes emits a placeholder job id at dispatch that
never gets a runner and never finalizes (`status='queued'`, empty
conclusion), then creates a second id for the same job that actually
runs to completion. The old query flagged a commit as pending if *any*
job had an empty conclusion, so these dead "queued twins" made commits
on the "commits red on main, by hour" histogram show gray forever.
The fix adds a `job_identity` CTE that groups jobs by `(run_id,
run_attempt, exact job name)` and classifies each into failed / resolved
/ pending. A job stops counting as pending once its real twin finishes,
its parent `workflow_run` is `completed`, or it's been stuck longer than
the 36h staleness cutoff.
# Notes
- The 36h staleness threshold is based on the fact that after 36h a job
queued is as good as failed by a user perspective.
Signed-off-by: Jean Schmidt <contato@jschmidt.me>1 parent 9308e62 commit 6cf8e28
1 file changed
Lines changed: 44 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
| |||
47 | 48 | | |
48 | 49 | | |
49 | 50 | | |
| 51 | + | |
50 | 52 | | |
51 | 53 | | |
52 | 54 | | |
| 55 | + | |
| 56 | + | |
53 | 57 | | |
54 | 58 | | |
55 | 59 | | |
| |||
74 | 78 | | |
75 | 79 | | |
76 | 80 | | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
77 | 116 | | |
78 | 117 | | |
79 | 118 | | |
| |||
83 | 122 | | |
84 | 123 | | |
85 | 124 | | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
92 | 130 | | |
93 | 131 | | |
94 | 132 | | |
| |||
0 commit comments