code wiki / _hdl_build / nx_apm_sweep.nx

nx_apm_sweep.nx

buildroot/runtime/_hdl_build/nx_apm_sweep.nx

12227 B220 linesdepth 22pulls 130 transitivereach 0 importersview sourcekind tooltopic apm
docsdependenciesstructsconstsfunctions

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

nx_fetch_unit.nx nx_syscalls.nx nx_apm_sweep.nx

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

main sys_now_ms sys_mmap sys_clock_gettime_mono sys_now_realtime_sec sys_mmap ↻ sys_clock_gettime_real aps_w sys_write aps_slen aps_wn sys_mmap ↻ aps_n sys_mmap ↻ sys_write ↻ aps_burst sys_fork sys_mmap ↻ aps_probe sys_mmap ↻ sys_now_ms ↻ nx_fetch_staged trust_store_alloc sys_mmap ↻ nx_pem_trust_load_file sys_mmap ↻ sys_read_file sys_openat_rd sys_lseek sys_mmap ↻ sys_read sys_close nx_pem_trust_load nx_str_len _pem_find sys_mmap ↻ b64_decode x509_parse trust_store_add sys_now_realtime_sec ↻

structs

none

consts

15const APS_MAGIC_1024: i64 = 1024
16const APS_MAGIC_65536: i64 = 65536
18const APS_STALL_MS: i64 = 2000
19const APS_TIMEOUT_MS: i64 = 18000
20const APS_METRICS: *u8 = "knowledge/status/apm_metrics.tsv"

functions

22func aps_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
called by 2: aps_waps_burst
23func aps_w(s: *u8) -> i64 { return sys_write(1, s, aps_slen(s)) }
called by 2: aps_burstmain calls 2: sys_writeaps_slen
25func aps_n(buf: *u8, off: i64, v: i64) -> i64
35func 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 }
36func 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) }
38func aps_wpad(v: i64, w: i64) -> i64
called by 1: aps_burst calls 3: sys_mmapaps_nsys_write
45func aps_status(buf: *u8, n: i64) -> i64
60func aps_probe(url: *u8, out_status: *i64) -> i64
72func aps_mkpath(path: *u8, base: i64, k: i64) -> i64
called by 1: aps_burst calls 2: aps_saps_n
79func aps_2ints(data: *u8, n: i64, out: *i64) -> i64
called by 1: aps_burst
98func aps_sort(a: *i64, n: i64) -> i64
called by 1: aps_burst
109func aps_burst(url: *u8, label: *u8, conc: i64, base: i64, epoch: i64) -> i64
188func 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
189func aps_seg_index(label: *u8) -> i64
197func main(argc: i64, argv: *i64) -> i64