Skip to content

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.

MR settings

Settings

How to set up and validate locally

  1. Go to any MR diff page.
  2. You should see a few network requests sent to /api/:version/usage_data/increment_unique_users.
  3. Reload the page, you should not see any network request to /api/:version/usage_data/increment_unique_users.
  4. 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)
  5. Reload the page, you should see a few network requests sent to /api/:version/usage_data/increment_unique_users.

  1. Interact with the MR settings
  2. 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.

Edited by Axel García

Merge request reports