code wiki / (root) / sketch_observability_dashboard_bench.nx

sketch_observability_dashboard_bench.nx

buildroot/runtime/sketch_observability_dashboard_bench.nx

6663 B192 linesdepth 6pulls 16 transitivereach 0 importersview sourcekind benchtopic sketch
docsdependenciesstructsconstsfunctions

about

sketch_observability_dashboard_bench.nx -- COMPOSITION integration bench. CLAIM TO VALIDATE: Substrate composes -- multiple sketches running on the SAME stream stay sub-linear in memory AND each track its metric accurately. This integration bench demonstrates the cardinal "composition over configuration": a realistic observability workload built from 4 sketches running side-by-side. WORKLOAD (simulated APM telemetry): For each of 5000 events: event.user_id -> HLL (track unique users) event.event_id -> CountSketch (estimate per-event frequencies, spotting top events) event.latency -> T-Digest (latency percentiles) event.latency -> AMS (F_2 = skew indicator) - user_ids range over 200 distinct (skewed to first 50) - event_ids range over 20 distinct (heavy tail at id=1) - latencies log-uniform in [1, 10000] microseconds MEMORY BUDGET: HLL lg_k=8: 256 + 32 = 288 B CountSketch d=5 w=256: 10288 B (counter grid 10240 + header) T-Digest delta=100: ~20 KB AMS d=5 s=128: 5120 + 80 = 5200 B TOTAL: ~36 KB. vs naive (5000 event records × ~40 B): 200 KB. SUB-LINEAR composition wins on memory. EACH METRIC VERIFIED INDEPENDENTLY: - HLL within 25% of 200 unique users - CountSketch correctly identifies event_id=1 as heaviest - T-Digest p99 within 30% of true p99 latency - AMS F_2 within 50% of true F_2 (skew indicator)

dependencies 6 imports · 0 importers

syscalls.nx sketch_hll.nx sketch_count_sketch.nx sketch_tdigest.nx sketch_ams.nx sketch_types.nx sketch_observability_dashboard

imports: syscalls.nxsketch_hll.nxsketch_count_sketch.nxsketch_tdigest.nxsketch_ams.nxsketch_types.nx

imported by: nobody (leaf or entry point)

structs

none

consts

59const NX_OD_LCG_A: i64 = 1103515245
60const NX_OD_LCG_C: i64 = 12345
61const NX_OD_LCG_MOD: i64 = 0x7FFFFFFF

functions

43func iabs_od(x: i64) -> i64
48func write_bod(buf: *u8, value: i64) -> i64
63func main() -> i64