Reduce volume of diff view event calls
What does this MR do and why?
Related to #361061 (closed)
On https://gitlab.com/gitlab-org/product-intelligence/-/issues/548#note_920147437 we discuss the high volume of RedisHLL events coming from the MR settings, dispatched anytime the MR diff page is rendered. This MR reduces the number of events while trying not to impact the usage of this data, by:
- Only dispatching these events (render the MR diff page) once daily.
- Dispatch any interaction in the merge request settings.
Screenshots or screen recordings
No visual changes.
How to set up and validate locally
- Go to any MR diff page.
- You should see a few network requests sent to
/api/:version/usage_data/increment_unique_users
. - Reload the page, you should not see any network request to
/api/:version/usage_data/increment_unique_users
. - Set the limit timestamp to less than 24h from now and refresh the page.
// In the browser's console localStorage.setItem('code_review_events_dispatched', Date.now() - 86400001)
- Reload the page, you should see a few network requests sent to
/api/:version/usage_data/increment_unique_users
.
- Interact with the MR settings
- You should see a few network request sent to
/api/:version/usage_data/increment_unique_users
after any change.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Axel García