code wiki / _hdl_build / nx_metrics_ring.nx
nx_metrics_ring.nx
buildroot/runtime/_hdl_build/nx_metrics_ring.nx
about
nx_metrics_ring.nx -- SOVEREIGN metrics time-series store (the TSDB the maturity census named as the
supervisor domain's #1 observability gap: /status is point-in-time, there was NO history). A fixed-size
binary RING (no SQL, no float, no TSV -- append-only, WRAPS at capacity so disk is BOUNDED by construction,
respecting the disk-budget law). Each sample = 32 bytes: ts_sec | name_hash(FNV-1a) | verdict | fails.
Library half (no main): the sampler daemon appends; the CLI + nx_heal query. license_tier: ORIGINAL
dependencies 1 imports · 3 importers
imports: nx_syscalls.nx
imported by: nx_daemon_supervisor.nxnx_metrics.nxnx_sweep_daemon_lib.nx
structs
| none |
consts
| 7 | const MR_MAGIC_2166136261: i64 = 2166136261 |
| 8 | const MR_MAGIC_16777619: i64 = 16777619 |
| 9 | const MR_MAGIC_4294967295: i64 = 4294967295 |
| 11 | const MR_MAGIC: i64 = 5928237 // ring header sentinel |
| 12 | const MR_HDR: i64 = 64 // header bytes |
| 13 | const MR_REC: i64 = 32 // record bytes: ts(8) namehash(8) verdict(8) fails(8) |
| 14 | const MR_CAP: i64 = 262144 // ~8.4MB file, ~29h of 37-daemon 15s samples (bounded) |
| 15 | const MR_V_SERVING: i64 = 1 |
| 16 | const MR_V_REFUSED: i64 = 2 |
| 17 | const MR_V_HUNG: i64 = 3 |
| 18 | const MR_V_BADRESP: i64 = 4 |
functions
| 20 | func mr_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } |
| 22 | func mr_hash(s: *u8) -> i64 |
| 33 | func mr_pread(fd: i64, off: i64, buf: *u8, n: i64) -> i64 |
| 39 | func mr_pwrite(fd: i64, off: i64, buf: *u8, n: i64) -> i64 |
| 45 | func mr_geti(buf: *u8, o: i64) -> i64 |
| 51 | func mr_puti(buf: *u8, o: i64, v: i64) -> i64 called by 1: mr_append |
| 59 | func mr_append(path: *u8, ts: i64, namehash: i64, verdict: i64, fails: i64) -> i64 |
| 96 | func mr_count(fd: i64, hdr: *u8) -> i64 |
| 104 | func mr_uptime(path: *u8, namehash: i64, window_sec: i64, now: i64) -> i64 |