Data
The event lake and GDPR retention
Bringing more of CubeCraft's game events into the raw event lake on Kafka, Spark and Apache Doris, and expiring user events after about three months for GDPR.
- 3.5B+rows in the Apache Doris analytics store
- ~3 monthsretention for user events
The problem
To know how players actually use what we ship, the team needs the events behind it, landed somewhere they can query. Some important events weren’t making it in, some aggregations were quietly losing data, and player events have to expire on time for GDPR.
What I built
- Pipelines from Kafka and MySQL into Spark jobs that write into Apache Doris, where the team queries them
- Game-creation, chat and stat-change events brought into the raw event lake, stamped with event time rather than arrival time
- The Spark event processor now reports the aggregations it had been silently dropping on null values, instead of losing them
- User events expire automatically after about three months, for GDPR retention
- Game serversemit events
- Kafkatopics per event type
- Sparkparse, stamp event time, aggregate
- Apache Dorisraw lake + reports
- Retentionuser events expire at ~3 months
Two of the fixes in pseudocode
# event time, not arrival time
for record in kafka.batch(topic):
event = parse(record)
event.ts = event.payload.occurred_at ?? record.timestamp
lake.append(event)
# don't silently drop what can't be aggregated
for group in events.group_by(key):
if group.has_null(key_fields):
dropped.count(group.event_type) # reported, not swallowed
continue
aggregates.write(summarize(group))
report.include(dropped)
Why it matters
Analytics are only as good as what makes it into them. More of the game is visible now, the gaps are reported instead of hidden, and user events expire on schedule.