Add cumulative registrations report (LG-8679)#7674
Conversation
changelog: Internal, Reporting, Add new cumulative registrations reporting
| sql = format(<<-SQL, params) | ||
| SELECT | ||
| COUNT(*) AS total_users | ||
| , created_at::date AS date | ||
| FROM users | ||
| WHERE | ||
| created_at <= %{finish} | ||
| GROUP BY | ||
| created_at::date | ||
| SQL |
There was a problem hiding this comment.
This is a table scan, ~100,000ms in prod. We could likely speed it up if we added an index on users.created_at, unsure how others feel about the cost/benefit of that
There was a problem hiding this comment.
Doesn't feel worthwhile if it's only for a report
| sql = format(<<-SQL, params) | ||
| SELECT | ||
| COUNT(*) AS fully_registered_users | ||
| , registered_at::date AS date | ||
| FROM registration_logs | ||
| WHERE | ||
| registered_at <= %{finish} | ||
| GROUP BY | ||
| registered_at::date | ||
| SQL |
There was a problem hiding this comment.
this is indexed already, relatively fast query
| { | ||
| finish: finish, | ||
| results: results.as_json, | ||
| } |
There was a problem hiding this comment.
one note: other reports collect a single day at a time (to keep calculations relatively cheap), and the frontend will make one request per day it's querying.
However, for this report, we always want to know all of time. So rather than have clients make requests going back each day to 2017 (1000+ requests), I opted to save client time so the clients only need to query one "day" to get all time.
I think it's a worthwhile tradeoff, but open to feedback!
There was a problem hiding this comment.
Do we want to write over the same file in S3 then? It could get quite large.
There was a problem hiding this comment.
no this will make a new file every day, just like the current reports. A report from last week is about 152kb, so not that big IMO
|
Got the OK to ship this! It's ready for review! |
🎫 Ticket
LG-8679
🛠 Summary of changes
Adds a new daily reporting job that loads all-time user registrations (both plain
User.countand fully registered users)In "do not merge" while I still confirm we're OK to launch itUpdate: It's ready to go! 🚀