Usage Metering & Billing Pipeline · View 09 of 22 · Data
Decisions
- Aggregation is on event time with an explicit watermark, not on arrival time. Usage belongs to the period in which it happened, and a mobile or edge producer that was offline for an hour must not move revenue between months.
- Rejected events are quarantined with their reason and replayed after the defect is fixed, never discarded. A silent discard is indistinguishable from usage that never happened.
- The baseline detector reads aggregates, not events, so it can see an account's shape change without re-scanning the ledger.
Assumptions
- Lateness bound of 72 hours (stated assumption), chosen to cover an offline edge or mobile producer and a long weekend, and short enough that the period can close within the invoice run's window.
- Deduplication window of 7 days (stated assumption), covering the longest expected producer retry.
Risks
- Unique-entity counting is the one aggregate that is not cheaply incremental; at 400 meters it is the likeliest source of aggregation cost surprise, which is why cost-per-meter is a watched signal in view 18.
- A watermark that advances on a quiet partition will close a period early for that partition. Idle-partition handling is a Flink configuration detail with a revenue consequence.