code wiki / _hdl_build / nx_apm_dashboard.nx

nx_apm_dashboard.nx

buildroot/runtime/_hdl_build/nx_apm_dashboard.nx

13402 B228 linesdepth 2pulls 2 transitivereach 1 importersview sourcekind tooltopic apm
docsdependenciesstructsconstsfunctions

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

nx_syscalls.nx nx_apm_dashboard.nx nx_apm_dashboard_gate.nx

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

main sys_mmap ad_bs ad_read_small sys_openat_rd sys_read sys_close ad_w sys_write ad_slen ad_find_or_add ad_streq ad_kv ad_starts ad_bn sys_mmap ↻ ad_verdict ad_vcolor ad_vname sys_openat_wr sys_write ↻ sys_close ↻ ad_wn sys_mmap ↻ sys_write ↻

structs

none

consts

16const AD_MAGIC_65536: i64 = 65536
17const AD_MAGIC_4096: i64 = 4096
18const AD_MAGIC_262144: i64 = 262144
20const AD_TSV: *u8 = "knowledge/status/apm_collect.tsv"
21const AD_HTML: *u8 = "knowledge/status/apm_dashboard.html"
22const AD_MAX_LABELS: i64 = 64
23const AD_LBL_W: i64 = 40 // bytes per stored label
26const AD_GREEN: i64 = 0
27const AD_AMBER: i64 = 1
28const AD_RED: i64 = 2
29const AD_DOWN: i64 = 3

functions

31func ad_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
called by 2: ad_wgd_contains
32func ad_w(s: *u8) -> i64 { return sys_write(1, s, ad_slen(s)) }
called by 1: main calls 2: sys_writead_slen
33func ad_wn(v: i64) -> i64
called by 1: main calls 2: sys_mmapsys_write
40func 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 }
41func 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
44func ad_read_small(path: *u8, buf: *u8, cap: i64) -> i64
52func ad_field(buf: *u8, n: i64, pos: i64, out: *u8, outcap: i64, stop: *i64) -> i64
65func 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 }
called by 3: maingd_recmain
67func ad_bn(buf: *u8, off: i64, v: i64) -> i64
called by 3: maingd_wngd_rec calls 1: sys_mmap
78func ad_verdict(conc: i64, oks: i64, stalls: i64, timeouts: i64, downs: i64) -> i64
called by 1: main
85func ad_vname(v: i64) -> *u8
called by 1: main
91func ad_vcolor(v: i64) -> *u8
called by 1: main
99func ad_find_or_add(store: *u8, np: *i64, name: *u8) -> i64
called by 1: main calls 1: ad_streq
112func ad_starts(buf: *u8, ls: i64, end: i64, key: *u8) -> i64
called by 1: ad_kv
117func ad_kv(buf: *u8, n: i64, key: *u8) -> i64
called by 1: main calls 1: ad_starts
131func main(argc: i64, argv: *i64) -> i64