In order to compute a "relative trending" metric in real time, we also need to have stats about the regular views of each page. With this information, we can compare the base line with the current traffic and decide if a page is trending or not.
We already have some stats in wmf.pageivew_hourly that include the hourly view count for each page. Using this table, we need to compute the average and standard deviation, so we'll be able to compute a z-score later, that along with a threshold, we'll use to identify "trending".
This data needs to be refreshed periodically, but we could do this manually for the MVP. As this data is only the baseline, we could update it weekly for example.
This is going to be split into subtasks, and we need to do the following: