sketch_observability_dashboard_bench.nx
buildroot/runtime/sketch_observability_dashboard_bench.nx
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
imports: syscalls.nxsketch_hll.nxsketch_count_sketch.nxsketch_tdigest.nxsketch_ams.nxsketch_types.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
| 59 | const NX_OD_LCG_A: i64 = 1103515245 |
| 60 | const NX_OD_LCG_C: i64 = 12345 |
| 61 | const NX_OD_LCG_MOD: i64 = 0x7FFFFFFF |
functions
| 43 | func iabs_od(x: i64) -> i64 called by 1: main |
| 48 | func write_bod(buf: *u8, value: i64) -> i64 called by 1: main |
| 63 | func main() -> i64 |