Usage Metering & Billing Pipeline · View 11 of 22 · Data
Decisions
- event_id is producer-assigned and is the primary key, which puts the idempotency boundary at the producer. The alternative — a server-side content fingerprint — is question 1 of the requirement and is unresolved; this model takes the producer side.
- aggregate carries event_range, the provenance that lets one invoice line be expanded back to its constituent events. Without it the evidence path in view 15 cannot exist.
- priced_line carries plan_version_id and fx_rate_date rather than a copy of the price, so re-rating a historical period reproduces the original amount exactly.
- restatement is an entity, not a log line: it holds the scope, the authorising identity and both figures.
Assumptions
- Both event_ts and ingest_ts are retained on every event, so clock skew is visible rather than silently trusted.
- dimensions is an open map; pricing may depend on any key in it, which is what lets a new dimensioned meter ship as configuration.
Risks
- An open dimension map is an open cardinality risk: a producer that puts a request id in it will make the aggregate grain per-event, and the cost-per-meter signal is the only thing that will notice.
- The dashed credit drawdown relation is where double-spend lives if balance entries are not written under the same transaction as the line that consumed them.