fix update of GA4 pageview data for questions #6420
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
mozilla/sumo#1913
Notes
Reload Question Traffic Stats
weekly cron has been broken for over 5 months. This PR fixes it.kitsune.sumo.googleanalytics.pageviews_by_question()
function returns multiple rows for each question ID -- one for each locale that a question was viewed in during the past 365 days -- and that means that more than 700K rows can be returned inprod
. In this PR, it returns adict
with one entry for each question ID where the value of that entry is the total pageviews of the question across all locales, which means over 300K entries inprod
.QuestionVisits.reload_from_analytics()
method was causing an OOM error because it was building theinstance_by_question_id
dict
for all questions at once. In this PR, that's now done in batches of 30K.prod
environment.