Add `lastDuoActivityOn` field to UserGraphQL type
Summmary
As part of #501462 (closed) we need to introduce new field lastDuoActivityOn for user GraphQL type which should return last time a user used any Duo feature. The scope of this issue is to introduce new field and provide tracking interface which can be used by other teams to trigger lastDuoActivityOn refresh when needed.
Technical proposal
- Create
Ai::UserMetricsmodel which is simple(user_id, last_duo_activity_on)pair.last_duo_activity_oncan be a date only. - Create
LastDuoActivityTrackerclass which should be responsible for storing and tracking duo activity values. Proposed interface:LastDuoActivityTracker#update(user). The tracker should NOT write directly to postgres but rather use Redis buffer approach to pile up updates. - Create
LastDuoActivityRefreshWorkerbackground worker which should be responsible for taking data from Redis buffer and upserting data toUserDuoActivitymodel. The worker can run every 10 minutes or so. - Create
lastDuoActivityOnfield for GraphQLAddOnUserTypewhich exposes data fromUserDuoActivity. - Access should be controlled by parent object. so no new access rules are needed.
Edited by Pavel Shutsin