Commit de45e24
authored
fix: use idle-based CPU formula in dashboard charts and alert evaluator (#54)
* fix: handle BigInt serialization in REST API v1 detail endpoints
GET /api/v1/pipelines/:id and /api/v1/nodes/:id return 500 because
NodePipelineStatus contains BigInt fields (eventsIn, eventsOut, etc.)
that JSON.stringify cannot serialize. Adds a jsonResponse() helper
using a custom replacer to convert BigInts to numbers.
* fix: use idle-based CPU formula in dashboard charts and alert evaluator
The fleet detail page correctly uses (total - idle) / total for CPU%,
but the dashboard charts and alert evaluator still used the old
cpuDelta / wallClockSeconds formula which gives per-core percentages
(e.g. 787% on an 8-core machine). This aligns all CPU calculations to
the same idle-based formula clamped to 0-100%.
Affected code paths:
- dashboard.chartMetrics: chart CPU time-series
- dashboard.nodeCards: sparkline CPU values
- alert-evaluator getCpuUsage: alert threshold checks1 parent bbcb3a7 commit de45e24
2 files changed
Lines changed: 29 additions & 17 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
149 | 149 | | |
150 | 150 | | |
151 | 151 | | |
| 152 | + | |
152 | 153 | | |
153 | 154 | | |
154 | 155 | | |
| |||
227 | 228 | | |
228 | 229 | | |
229 | 230 | | |
230 | | - | |
231 | | - | |
232 | | - | |
233 | | - | |
234 | | - | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
235 | 247 | | |
236 | 248 | | |
237 | 249 | | |
| |||
683 | 695 | | |
684 | 696 | | |
685 | 697 | | |
| 698 | + | |
686 | 699 | | |
687 | 700 | | |
688 | 701 | | |
| |||
803 | 816 | | |
804 | 817 | | |
805 | 818 | | |
| 819 | + | |
806 | 820 | | |
807 | 821 | | |
808 | 822 | | |
| |||
826 | 840 | | |
827 | 841 | | |
828 | 842 | | |
829 | | - | |
830 | | - | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
831 | 848 | | |
832 | 849 | | |
833 | 850 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
46 | | - | |
| 46 | + | |
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
52 | | - | |
53 | | - | |
54 | | - | |
| 52 | + | |
| 53 | + | |
55 | 54 | | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
| 55 | + | |
| 56 | + | |
62 | 57 | | |
63 | 58 | | |
64 | 59 | | |
| |||
0 commit comments