The system. An industrial telemetry platform: several sites, machines with multiple sensors, data at one-second resolution, dashboards showing live values and historical trends from one hour to one year, alerting on thresholds, and devices that go offline and buffer. Data arrives through a durable log.
Three invariants must hold:
- Series cardinality stays within a declared budget at the declared fleet size, verified by measurement, with the growth per added machine and per added sensor stated so that the budget can be checked against a growth plan.
- Every rollup level agrees with the level below it, verified by a scheduled drift query, including after late data has arrived - which means the recomputation window is wide enough for the lateness the fleet actually produces.
- Retention behaves as declared: data older than each level's retention is gone, data within it is present, and a dashboard query at each time range returns the expected resolution - verified rather than assumed.
Invariant 2 is this capstone's distinguishing requirement. A rollup is derived data that nothing checks, and the characteristic failure of a telemetry platform is a dashboard confidently showing an aggregate that no longer matches its source because a device reconnected after a long outage. A capstone without the drift query running on a schedule has not demonstrated invariant 2 - it has demonstrated that the rollups were correct once.
What is assessed. 20% knowledge checks, 35% laboratory portfolio, 15% troubleshooting practical, 30% capstone. Three things carry the capstone.
A cardinality budget with the growth arithmetic. The tag schema, the measured series count, and the series added per machine, per sensor and per site - so the answer to "can we add a tag?" is a number. Include the measurement from Module 4 showing what happens past the budget.
Rollup correctness under late data, demonstrated. The cascade, the lateness window with the number in it, the trailing recomputation, the drift query on a schedule, and the counter of points arriving beyond the window. Demonstrated by injecting late data and showing the drift appear and then resolve.
A retention policy priced and stated in product terms. Not "we keep data for a year" - the cascade, its storage cost, and the sentence saying what question can no longer be answered. That sentence is the one stakeholders have to agree to and the one they are usually never shown.
Deliverables: architecture diagram including the durable log and the rollup path; the tag and field schema with the cardinality budget and growth arithmetic; the downsampling cascade with its mechanism; source code including the batching writer, the rollup jobs with trailing recomputation, and the lateness counter; the telemetry generator; benchmark report with the cardinality curve and the raw-against-rollup comparison; security review including the scoped token set; recovery runbook with the measured replay rate and the degradation design; retention cost model with the product statement; and a short design defence.
-- ================= Invariants, as runnable checks ==================
-- 1. *** SERIES CARDINALITY WITHIN A DECLARED BUDGET, with the
-- *** GROWTH ARITHMETIC. ***
SELECT COUNT(*) AS series FROM (
SELECT DISTINCT site, machine, sensor, unit FROM machine_telemetry);
-- budget 100,000
-- measured 43,200
--
-- GROWTH, so "can we add a tag?" has a NUMBER as its answer:
-- per machine added = sensors(12) x units(1) = 12
-- per sensor added = machines(40) x sites(3) = 120
-- per site added = machines(40) x sensors(12) = 480
-- *** per TAG added = current series x its distinct values ***
-- adding firmware_version(5) -> 43,200 x 5 = 216,000 OVER
-- adding shift(3) -> 43,200 x 3 = 129,600 OVER
-- adding job_id(50,000) -> *** 2,160,000,000 *** NO
--
-- And the measurement from Module 4 for what happens past it:
-- "at 1,000,000 series our query p95 goes from 48 ms to 310 ms
-- and ingestion falls 48%; at 10,000,000 the 2.x instance
-- exhausts memory."
-- *** THAT TURNS A SCHEMA ARGUMENT INTO ARITHMETIC. ***
-- 2. *** EVERY ROLLUP LEVEL AGREES WITH THE LEVEL BELOW IT -
-- *** INCLUDING AFTER LATE DATA. ***
-- raw -> 1m
SELECT r.time, r.machine, r.sensor, r.mean_value AS rollup,
x.mean AS recomputed, ABS(r.mean_value - x.mean) AS drift
FROM machine_telemetry_1m r
JOIN (SELECT date_bin(INTERVAL '1 minute', time) AS time,
machine, sensor, AVG(value) AS mean
FROM machine_telemetry
WHERE time >= now() - INTERVAL '48 hours'
GROUP BY 1, machine, sensor) x
ON x.time = r.time AND x.machine = r.machine AND x.sensor = r.sensor
WHERE ABS(r.mean_value - x.mean) > 0.0001;
-- Expected: no rows.
-- 1m -> 1h, using the sample-weighted mean so the check is EXACT:
SELECT h.time, h.machine, h.mean_value AS rollup, m.recomputed
FROM machine_telemetry_1h h
JOIN (SELECT date_bin(INTERVAL '1 hour', time) AS time, machine,
SUM(mean_value * samples) / SUM(samples) AS recomputed
FROM machine_telemetry_1m
WHERE time >= now() - INTERVAL '7 days'
GROUP BY 1, machine) m
ON m.time = h.time AND m.machine = h.machine
WHERE ABS(h.mean_value - m.recomputed) > 0.0001;
-- Expected: no rows.
--
-- *** A CAPSTONE WITHOUT THIS QUERY RUNNING ON A SCHEDULE HAS NOT
-- *** DEMONSTRATED INVARIANT 2 - IT HAS DEMONSTRATED THAT THE
-- *** ROLLUPS WERE CORRECT ONCE. ***
--
-- The characteristic failure of a telemetry platform is a dashboard
-- CONFIDENTLY SHOWING AN AGGREGATE THAT NO LONGER MATCHES ITS SOURCE
-- because a device reconnected after a long outage. Nothing in the
-- database reports it. This query is the reporting.
-- 3. *** RETENTION BEHAVES AS DECLARED. *** Verified, not assumed:
-- (a) data OLDER than each level's retention is GONE:
SELECT COUNT(*) FROM machine_telemetry
WHERE time < now() - INTERVAL '8 days'; -- raw kept 7d
-- Expected: 0.
SELECT COUNT(*) FROM machine_telemetry_1m
WHERE time < now() - INTERVAL '91 days'; -- 1m kept 90d
-- Expected: 0.
-- (b) data WITHIN it is PRESENT:
SELECT COUNT(*) FROM machine_telemetry
WHERE time >= now() - INTERVAL '6 days'
AND time < now() - INTERVAL '5 days';
-- Expected: ~ the full expected sample count.
-- (c) a dashboard query at each range returns the EXPECTED
-- RESOLUTION - which is the product-facing version of the test.
-- ================= Late data, handled explicitly ==================
-- *** THE LATENESS POLICY, WITH THE NUMBER IN IT: ***
-- "Points arriving up to 24 HOURS after their timestamp are fully
-- incorporated: the 1m, 1h and 1d rollups are recomputed over a
-- trailing 24-hour window on every run. Points arriving later
-- than 24 hours are accepted into raw data (if within its 7-day
-- retention) and DO NOT change the rollups. A counter records
-- them, and a rising count means devices are offline longer than
-- the design assumes."
--
-- The trailing recomputation, idempotent by delete-and-reinsert:
DELETE FROM machine_telemetry_1h WHERE time >= now() - INTERVAL '24 hours';
INSERT INTO machine_telemetry_1h
SELECT date_bin(INTERVAL '1 hour', time) AS time, site, machine, sensor,
SUM(mean_value * samples) / SUM(samples),
MIN(min_value), MAX(max_value), SUM(samples), SUM(faults)
FROM machine_telemetry_1m
WHERE time >= now() - INTERVAL '24 hours'
GROUP BY 1, site, machine, sensor;
-- And the counter, in the ingestion consumer:
-- lateness = ingest_time - point_time
-- if lateness > LATENESS_WINDOW:
-- metrics.increment("influx.points.beyond_lateness_window",
-- tags={"site": site, "machine": machine})
-- ALERT ON IT. It is operational news about the fleet, not a
-- database metric.
-- ================= Declare the baseline BEFORE measuring ==========
--
-- Generation: InfluxDB 3 Core (SQL, Parquet) <- STATED, with the
-- reason, and the 2.x migration cost acknowledged
-- Ingestion: durable log (Redpanda) -> consumer -> InfluxDB
-- batch 5,000, flush 1,000 ms, gzip, 4 writers
-- *** flush 1,000 ms = up to 900,000 points lost if a
-- *** writer dies. Accepted, and stated. ***
-- Schema: tags site, machine, sensor, unit (BOUNDED)
-- fields value, rpm, fault, job_id (job_id is a
-- FIELD)
-- measurements split by sensor KIND, for independent
-- retention
-- Cascade: raw 1s/7d -> 1m/90d -> 1h/2y -> 1d/10y
-- Lateness: 24 hours, trailing recomputation, counter beyond
-- Tokens: per-site WRITE-ONLY to raw; dashboard READ-ONLY on
-- rollups; downsampler read raw / write rollups
--
-- Claim:
-- sustained ingest > 800,000 points/s
-- series cardinality < 100,000 (budget)
-- live dashboard (10 min, raw) p99 < 60 ms
-- 1-day trend (1m rollup) p99 < 80 ms
-- 1-year trend (1d rollup) p99 < 250 ms
-- rollup drift = 0, continuously
-- replay rate ___ points/s, MEASURED
-- replayable window within a 4h RTO ___ hours of data
-- RPO = the log's retention
--
-- *** AND THE RETENTION COST MODEL, WITH THE PRODUCT STATEMENT: ***
-- cascade as designed 1.33 TB
-- raw-for-a-year alternative 51.6 TB (39x)
-- "A question needing 1-second resolution from three months ago
-- CANNOT BE ANSWERED. That is a deliberate choice and it saves
-- 50 TB."
-- *** THAT SENTENCE IS THE ONE STAKEHOLDERS HAVE TO AGREE TO AND
-- *** THE ONE THEY ARE USUALLY NEVER SHOWN. ***
-- ================= Failure modes ==================================
-- *** an id as a TAG CARDINALITY EXPLOSION. 2.x dies;
-- 3.x degrades. The budget
-- arithmetic prevents it. ***
-- two bounded tags whose 1,000 x 1,000 = 1,000,000. Each
-- COMBINATION is not tag looks fine in review.
-- a date as a tag ONE NEW SERIES EVERY DAY, forever.
-- *** late data after a rollup THE ROLLUP IS SILENTLY WRONG.
-- is computed Invariant 2, and the drift query
-- is the only detection. ***
-- late data past retention the write SUCCEEDS and the data is
-- IMMEDIATELY UNREACHABLE, or is
-- rejected. Either way NO ERROR
-- REACHES THE DEVICE.
-- a query with no time range reads the whole retention period.
-- Monitor the rate of these.
-- mean-of-means in the cascade SUBTLY WRONG aggregates. Store
-- count and sum; weight the mean.
-- gap filled with 0 for a a 0-degree reading on the chart
-- temperature and into the alert threshold.
-- field type conflict the write is REJECTED. A CLIENT
-- bug, not capacity - monitor them
-- separately.
-- flush interval too long more buffered data lost on a
-- writer crash. A stated trade.
-- one all-access token in the compromise reads everything, and
-- firmware rotation means REFLASHING THE
-- FLEET.
-- replica treated as a backup a destructive write REPLICATES.
-- replay slower than the the outage continues through the
-- outage recovery. Design the degradation.
-- 2.x -> 3.x assumed to be an it is an EXPORT, A RELOAD AND A
-- upgrade REWRITE OF EVERY FLUX QUERY.
--
-- Verify after every recovery with the three invariants - not with a
-- point count. A dataset with the right number of points and the
-- wrong values looks exactly like a correct one.
Discussion
No questions on this topic yet. Sign in to ask the first one.