ADR-0245: The estate charts read history in one cached per-caller read
- Status: accepted
- Date: 2026-12-05
- Deciders: Mahdi Amirabdollahi
- Supersedes: decisions 1 (the first health note as the cause) and 4 (one request) of ADR-0238; its decisions 2, 3 and 5 remain
Context
ADR-0238 serves the Dashboard from one request over a cached digest, never calling a broker. The redesigned Dashboard charts the estate over time (messages added, acknowledged, backlog, with a previous-window baseline), which the digest does not hold. Building it per viewer and per cluster would multiply database reads by viewers and clusters. Four things surfaced while designing it: the digest keeps only the first health note, and that note can be the milder one; Kafka and RabbitMQ store undeclared counters as zero, so their throughput is a false flat line; the digest cuts at 200 clusters in name order, so a critical cluster can vanish; and the 15m range uses a 15 s step, below the 60 s sample floor of ADR-0220.
Decision
- History is a second bounded read,
GET /api/v1/estate/series?range=15m|1h|6h|24h|7d. The Dashboard now makes two requests whatever the number of clusters: the overview for current state (decisions 1-3 and 5 of ADR-0238 stand) and the series. Neither calls a broker. Ranges are fixed (window and step per range, the newest in-progress bucket left out); there is no absolute window, which would defeat the shared cache. - The history is built once per range and bucket, not per viewer.
EstateHistoryholds at most five entries, builds them single-flight under the no-caller context over every registered cluster with two statements (a rate scan and a gauge) of 10 s timeout each, and holds a failure for one step. Each request then filters it per caller: a cluster whose subscriptions the caller does not read in full is withheld from every series and named, the rule of ADR-0238 decision 5. The clamp of the per-cluster metrics query is lifted into one shared function. - Health causes are exposed, most severe first.
ClusterRow.healthNotes(at most 5) is ordered critical, degraded, then unread by one builder used by every evaluator;healthCauseis the first. This supersedes decision 1 of ADR-0238. - The 200-cluster cap keeps the clusters that most need attention, ranked unreachable or critical, then degraded, then stale, then alerting, then healthy, then by name, and the series read considers the same set. Health and node totals count every cluster the caller sees and are not withheld from partial readers, because they are cluster-level data, not subscription-level.
- A counter a kind does not declare is not stored.
cluster_kind.metricsrecords what each kind declares; the sample writer skips the rest; a cluster with no registered kind is stored as before (unknown is not unavailable). Those figures read "not reported", andClusterRow.inFlightbecomes aMeasure(breaking; no compatibility before the stable release). - "Since" for a health finding is when this server first saw the level, worded "Seen since", held in memory per replica, pruned to the digest's clusters and reset when the level changes. Alert findings use their persisted start.
- No new dependency.
@mantine/charts9.8.3 overrecharts3.11.3 cover the charts. Checked on ctx7 (/mantinedev/mantine/9.0.0):syncIdthroughlineChartPropsandcomposedChartProps;connectNullsdefaults to true and is set to false so gaps stay gaps;ReferenceAreaas a child since Mantine 8.1.0.syncMethod="value"is unverified and is not used unless confirmed on ctx7 and added here. - Per-cluster breakdown uses small multiples on one ink and one scale, not coloured lines, because ADR-0158 forbids a categorical palette and more than three chart colours cannot be told apart anyway. No new token is added. If a token step must change (the dashed previous-window line on
--as-chart-3failing 3:1 in light), the value change is recorded here with before and after ratios for both schemes and every--as-chart-3consumer is re-measured. - Revisit a rollup table when an installation passes 200 clusters at the 7d range, where the history build scans a week of samples.
Consequences
- Easier: one cached read serves every viewer; the Dashboard answers "is traffic normal" without a broker call; false zero throughput disappears; the first cause is the worst one.
- Harder: two requests instead of one, and ADR-0238's "one endpoint" no longer holds. A slow database fails history alone, which the page shows beside intact current state.
- Kafka and RabbitMQ throughput charts are empty with a reason until their drivers declare the counters, which is honest but emptier.
- "Seen since" can differ between replicas and resets on restart. Persisting level transitions is a follow-up.
- Breaking:
inFlightchanges type and the clusters baseline changeset gains a column; operators recreate the database. - A 7d build for 200 clusters is a heavier scan, accepted up to that bound.
Alternatives considered
- A per-cluster series request from the browser: N requests per refresh and N database reads per viewer; rejected.
- A rollup table now: removes the scan but adds a write path and a migration for a bound nobody has reached; deferred (decision 9).
- Folding history into the overview response: makes the 15 s refresh carry up to 168 points times several series for every viewer, and couples a slow history read to the whole page; rejected.
- Typed per-system fact fields: need new columns for three systems and empty fields for plugin systems; ordered health causes carry the same facts in words.
- Coloured lines per cluster: needs a categorical palette (ADR-0158) and is unreadable where lines cross.
- A new charting library: nothing the page needs is missing from
@mantine/charts.