Improve Productivity Analytics error when query takes too long to calculate
Summary
Productivity Analytics for gitlab-org shows a loading spinner for approximately 15 seconds, then shows a message: "There is no data available. Please change your selection." (No chart is displayed). The async request for the data is returning a 500 (https://gitlab.com/groups/gitlab-org/-/analytics/productivity_analytics?group_id=gitlab-org&merged_after=2020-04-13T00:00:00Z&merged_before=2020-05-14T23:59:59Z&chart_type=histogram
). This 500 response is associated with a Sentry report for ActiveRecord::QueryCanceled.
Steps to reproduce
Note: This problem is intermittent, and may only occur when the production environment is under higher load.
What is the current bug behavior?
Saying "There is no data available" when there is too much data to be queried performantly.
What is the expected correct behavior?
A 500 error prompts a message about too much data.
Relevant logs and/or screenshots
Output of checks
This bug happens on GitLab.com.
Proposal
- Only if the request returns a 200 with an empty payload the displayed message is "There is no data available. Please change your selection."
- If the request returns a 500 the displayed message is "There is too much data to calculate. Please change your selection." (Note: This assumes the 500 is due to a timeout, but it's a better assumption than existed before.)