Implement redis based package events tracking
Problem Statement
Recently, package events tracking has been introduced using postgresql as a backend.
The amount of data/events collected is bigger than expected and the queries to aggregate this amount of data have been proven a bit too slow.
Proposed solution
The desired metrics can be achieved by using redis counters.
This would eliminate the need to accumulate events records but instead continuously aggregating the data on Redis.
Caveats
Unique counts in redis uses the HyperLogLog method which is a probalistic method with [a standard error of 2%)[https://thoughtbot.com/blog/hyperloglogs-in-redis]. This means the data we report on usage ping is not 100% accurate but has a small error.