code wiki / _hdl_build / nx_apm_sweep.nx
nx_apm_sweep.nx
buildroot/runtime/_hdl_build/nx_apm_sweep.nx
about
nx_apm_sweep.nx -- SOVEREIGN concurrency-aware APM probe sweep (the "New Relic" core).
WHY: the existing monitor (nx_site_monitor/nx_health_probe) is BINARY up/down and SINGLE-request,
and the HTTPS fetch used to read-until-close (measuring the ~19s keep-alive idle timeout, not real
latency). So a daemon that serves fine alone but STALLS under concurrent load ("switching tabs and
tabs don't load") showed all-green. This organ fixes that: it fires N SIMULTANEOUS cold probes per
endpoint (= N browser tabs) using the Content-Length-honest nx_fetch_staged, and reports the real
latency distribution + stalls + timeouts + error rate, with a durable per-endpoint time-series row.
usage: nx_apm_sweep [concurrency] (default 8)
out: per-endpoint report on stdout + appended rows in knowledge/status/apm_metrics.tsv
license_tier: ORIGINAL
dependencies 2 imports · 0 importers
imports: nx_fetch_unit.nxnx_syscalls.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 15 | const APS_MAGIC_1024: i64 = 1024 |
| 16 | const APS_MAGIC_65536: i64 = 65536 |
| 18 | const APS_STALL_MS: i64 = 2000 |
| 19 | const APS_TIMEOUT_MS: i64 = 18000 |
| 20 | const APS_METRICS: *u8 = "knowledge/status/apm_metrics.tsv" |
functions
| 22 | func aps_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } |
| 23 | func aps_w(s: *u8) -> i64 { return sys_write(1, s, aps_slen(s)) } |
| 25 | func aps_n(buf: *u8, off: i64, v: i64) -> i64 |
| 35 | func aps_s(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 } |
| 36 | func aps_wn(v: i64) -> i64 { let b: *u8 = sys_mmap(24); let e: i64 = aps_n(b, 0, v); return sys_write(1, b, e) } |
| 38 | func aps_wpad(v: i64, w: i64) -> i64 |
| 45 | func aps_status(buf: *u8, n: i64) -> i64 |
| 60 | func aps_probe(url: *u8, out_status: *i64) -> i64 |
| 72 | func aps_mkpath(path: *u8, base: i64, k: i64) -> i64 |
| 79 | func aps_2ints(data: *u8, n: i64, out: *i64) -> i64 called by 1: aps_burst |
| 98 | func aps_sort(a: *i64, n: i64) -> i64 called by 1: aps_burst |
| 109 | func aps_burst(url: *u8, label: *u8, conc: i64, base: i64, epoch: i64) -> i64 |
| 188 | func aps_line_eq(buf: *u8, start: i64, end: i64, label: *u8) -> i64 { var i: i64=start; var j: i64=0; while i<end { if buf[i]!=label[j] {return 0} i=i+1; j=j+1 } if label[j]!=(0 as u8) {return 0} return 1 } called by 1: aps_seg_index |
| 189 | func aps_seg_index(label: *u8) -> i64 called by 1: aps_burst calls 8: sys_mmapsys_openat_rdsys_readsys_closeaps_line_eqsys_openat_append+2 |
| 197 | func main(argc: i64, argv: *i64) -> i64 |