code wiki / _hdl_build / nx_apm_dashboard.nx
nx_apm_dashboard.nx
buildroot/runtime/_hdl_build/nx_apm_dashboard.nx
about
nx_apm_dashboard.nx -- SOVEREIGN "New-Relic-style" status board: renders the APM time-series
(knowledge/status/apm_collect.tsv, written by nx_apm_collect) into a self-contained HTML page.
TTFB-honest by construction: the verdict is recomputed from the row's stats (downs/timeouts/stalls),
and `slowclose` (keep-alive/idle-hold = fast first byte, slow close) is shown as an INFO badge, NEVER
as a failure -- so the board never reproduces the read-until-close "20s wedge" artifact. Zero 3rd-party
JS/CDN (sovereignty invariant): inline CSS only. Groups rows by daemon label, latest sample wins,
renders a colour-coded card grid + an incidents list.
in: knowledge/status/apm_collect.tsv (argv[1] overrides)
out: knowledge/status/apm_dashboard.html (argv[2] overrides)
TSV cols: epoch(0) label(1) port(2) path(3) conc(4) oks(5) nres(6) min(7) p50(8) p95(9) max(10)
stalls(11) timeouts(12) downs(13) maxtotal(14) slowclose(15)
license_tier: ORIGINAL
dependencies 1 imports · 1 importers
imports: nx_syscalls.nx
imported by: nx_apm_dashboard_gate.nx
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 16 | const AD_MAGIC_65536: i64 = 65536 |
| 17 | const AD_MAGIC_4096: i64 = 4096 |
| 18 | const AD_MAGIC_262144: i64 = 262144 |
| 20 | const AD_TSV: *u8 = "knowledge/status/apm_collect.tsv" |
| 21 | const AD_HTML: *u8 = "knowledge/status/apm_dashboard.html" |
| 22 | const AD_MAX_LABELS: i64 = 64 |
| 23 | const AD_LBL_W: i64 = 40 // bytes per stored label |
| 26 | const AD_GREEN: i64 = 0 |
| 27 | const AD_AMBER: i64 = 1 |
| 28 | const AD_RED: i64 = 2 |
| 29 | const AD_DOWN: i64 = 3 |
functions
| 31 | func ad_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } |
| 32 | func ad_w(s: *u8) -> i64 { return sys_write(1, s, ad_slen(s)) } |
| 33 | func ad_wn(v: i64) -> i64 |
| 40 | func ad_atoi(s: *u8) -> i64 { var v: i64 = 0; var i: i64 = 0; while s[i] != (0 as u8) { let c: i64 = s[i] as i64; if c >= 48 { if c <= 57 { v = v*10 + (c-48) } } i = i + 1 } return v } |
| 41 | func ad_streq(a: *u8, b: *u8) -> i64 { var i: i64 = 0; while a[i] != (0 as u8) { if a[i] != b[i] { return 0 } i = i + 1 } if b[i] != (0 as u8) { return 0 } return 1 } called by 1: ad_find_or_add |
| 44 | func ad_read_small(path: *u8, buf: *u8, cap: i64) -> i64 |
| 52 | func ad_field(buf: *u8, n: i64, pos: i64, out: *u8, outcap: i64, stop: *i64) -> i64 |
| 65 | func ad_bs(buf: *u8, off: i64, s: *u8) -> i64 { var o: i64 = off; var i: i64 = 0; while s[i] != (0 as u8) { buf[o] = s[i]; o = o + 1; i = i + 1 } return o } |
| 67 | func ad_bn(buf: *u8, off: i64, v: i64) -> i64 |
| 78 | func ad_verdict(conc: i64, oks: i64, stalls: i64, timeouts: i64, downs: i64) -> i64 called by 1: main |
| 85 | func ad_vname(v: i64) -> *u8 called by 1: main |
| 91 | func ad_vcolor(v: i64) -> *u8 called by 1: main |
| 99 | func ad_find_or_add(store: *u8, np: *i64, name: *u8) -> i64 |
| 112 | func ad_starts(buf: *u8, ls: i64, end: i64, key: *u8) -> i64 called by 1: ad_kv |
| 117 | func ad_kv(buf: *u8, n: i64, key: *u8) -> i64 |
| 131 | func main(argc: i64, argv: *i64) -> i64 |