[Contribution Analytics] Group level returns 500 with long-dated start_date param

Summary

The Contribution Analytics page for a group will return a 500 error if a start_date parameter is given that is too far in the past.

Steps to reproduce

  • Works: A start_date param of a few days ago: https://gitlab.com/groups/gitlab-org/-/analytics?start_date=2019-12-10
  • Returns 500 error: A start_date param of 3 months ago: https://gitlab.com/groups/gitlab-org/-/analytics?start_date=2019-09-13

What is the current bug behavior?

The page returns a 500 error response.

What is the expected correct behavior?

The page returns a 200 or 304 success response.

Relevant logs and/or screenshots

  • This was identified as one of the remaining 500 errors in the 2nd round of 500 error troubleshooting in 2019: 500 Errors found by Google Search Console on GitLab.com - 2019-12-13
  • Tim Zallmann says: "Would be great win to get this down to 0 soon. "Most important thing is that it doesn’t fall under the table, especially as it is soo big atm as a bad offender".

Output of checks

This bug happens on GitLab.com.

Proposal

Split queries by date range, retrieving one week per query and combining the data in Ruby. See thread for details.

Possible solutions considered

  • Improve query performance
  • Restrict the allowed range for the start_date parameter
  • Rescue 500 errors and display the page in its no-parameter form (with a flash message explaining)
Edited May 10, 2021 by Dan Jensen
Assignee Loading
Time tracking Loading