Sessions-per-User Inflated After a Tracking Change
PySpark · observability · Advanced · about 20 minutes
Impact
After a tracking update started logging every click and scroll as its own row, the engagement dashboard's sessions-per-user figure jumped.
Symptoms
- The aggregation job finished with status SUCCESS.
- User 102 visited once but is reported with 2 sessions.
- Event row counts rose after the tracking release; the number of distinct session ids did not.
- The latest-activity time per user still looks correct.
Evidence
user_actions profile
| measure | value |
|---|---|
| rows | 8 |
| distinct session_id | 5 |
| distinct user_id | 3 |
Sessions per user
| source | value |
|---|---|
| dashboard | 2.67 |
| distinct sessions / users | 1.67 |
user_actions for user 102
| user_id | session_id | action_time | action_type |
|---|---|---|---|
| 102 | S3 | 2024-01-02 09:00:00 | click |
| 102 | S3 | 2024-01-02 09:30:00 | scroll |
Investigation task
For each user, report the time of their most recent action as latest_session_time and their number of distinct sessions as unique_session_count. Build df_result with user_id, latest_session_time and unique_session_count, and finish with df_result.show().
The fix is written and graded in the regular challenge editor. The postmortem unlocks once the incident is resolved.