Skip to main content

Module model

Module model 

Source
Expand description

Layer 2 — the model. What the observations mean, without asking the bus anything.

One rule places a module here: it can do its job from values already in hand. Nothing below takes a session. A key becomes a described key (facts), a set of served slices becomes a queryable registry (registry) and a set of rows (project), a stream of samples becomes rates and latencies (stats) or a tree (tree, skeleton), two payloads become a diff (diff), a payload plus a schema becomes a rendering (decode).

Being session-free is the useful property, not an accident of history: it is what lets a frontend replay a .zrec through the same projections it runs live, and what lets these modules be unit-tested without a bus. A function here that finds it needs a session belongs in crate::bus, with this layer projecting what it brought back.

The layer also owns the two mechanisms every long-running projection shares: bounded (the O6 ceiling and its eviction ledger) and retain (the retention budget). A model that grows without a bound is not a model of a fleet, it is a leak.

Nothing here judges. stats reports a latency that contains clock skew and says so; it does not call the transport slow. Verdicts are crate::judge’s.

Modules§

bounded
The bound every long-lived table in this crate shares (RFC 09 §5.1 O6).
decodedecode
The schema-aware decode seam (issues #11/#15): wire key → type name → served schema → named-field JSON, with the honest fallbacks a generic tool owes its user.
diff
Payload diff (issue #63): what changed between two consecutive values of one key.
examples
“Up to N examples, and the count of what they stand for” — one collector (RFC 09 §5.1 O6).
facts
What an explorer can honestly say about one observed key (RFC 09 §5.1).
jsonschema
The bit of JSON Schema this crate has to walk itself (#384).
project
Everything answerable from a set of registry slices, without a bus.
registry
Registry-slice sets (RFC 08 §6): one type over both sources.
retain
The retained window (issue #217): a bounded ring of recent samples on the monitor’s ingest path, so “scrub back to before you noticed” needs no recording to have been running.
skeleton
The declared keyspace, built without subscribing to anything (issue #84).
stats
Windowed per-key statistics (issues #13/#15): message/byte counters and an exponentially-weighted rate, keyed by wire key. Backs zenctl rate (--bytes and all), echo --rate, and zengui’s tree badges.
tree
The live key tree (issue #15): an immutable snapshot of everything the monitor has seen, grouped by key chunks, with per-node statistics.