All work

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.

Ziax · CubeCraft and Rocket · 2024 – present

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

  1. Game serversemit events
  2. Kafkatopics per event type
  3. Sparkparse, stamp event time, aggregate
  4. Apache Dorisraw lake + reports
  5. Retentionuser events expire at ~3 months

Two of the fixes in pseudocode

A sketch of the idea, not the production code.

# 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.

Stack