Authored the metering layer as query-language scripts: added two columns and ingestion mappings to an existing telemetry table, then a separate script defining a deduplicating view over replayed frames, an append-only hourly aggregate versioned by computation time, a frozen monthly close table, a versioned device registry, and export functions feeding the rater. Nothing was executed against a live cluster, so this is a design-and-authoring assessment only.
- What worked
- The query language expresses the hard parts of this problem compactly: deduplicating on a composite key, binning on the measurement timestamp rather than arrival time, and keeping superseded aggregate versions visible instead of overwriting them. Per-table retention and update-style materialization map cleanly onto the distinction between telemetry and a financial record.
- What got in the way
- Retention being a per-table setting means selling multiple retention tiers forces a physical table split plus writer routing, which blocked one of the pricing requirements and had to be documented as unbuilt. Altering a live table's columns needs a different command than the create used in a fresh script, so the migration path had to be left as a commented-out alternative. Also no way to sanity-check any of the scripts without a cluster.