Extend total group usage visualization from 2 months to full year
What does this MR do and why?
Updates the product analytics usage data GraphQL endpoint:
- accept array of year/month pairs as query input instead of single year/month
- return array of monthly usage values instead of single count
- remove default query for current month
Update the product analytics usage quota frontend to use this updated structure:
- simplify GraphQL query to take inputs, instead of hardcoding for
current
/previous
months - simplify/remove projects mapping code
- extend group totals query from 2 months to 12 months
This all allows the group totals chart to display a full years worth of usage data. This is inline with other existing usage quota tabs.
Note: due to potential negative performance impact (see: https://gitlab.com/gitlab-org/gitlab/-/issues/430865+) an ops feature flag has been added: product_analytics_usage_quota_annual_data
. When enabled, 12 months of data is fetched. Otherwise, the existing 2 months. This flag will likely be removed in the future once https://gitlab.com/gitlab-org/gitlab/-/issues/430865 is out.
Screenshots or screen recordings
Before | After |
---|---|
(feature flag enabled) | |
(feature flag disabled) |
How to set up and validate locally
- Requires GitLab Ultimate.
- Follow these instructions to set up Product Analytics in your GDK.
- Enable product analytics
- Onboard a project with product analytics and generate some events
- Visit a group -> Settings -> Usage Quota
- Verify group totals chart displays 2 months worth of data
echo "Feature.enable(:product_analytics_usage_quota_annual_data)" | gdk rails c
- Verify group totals chart displays 12 months worth of data
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.
Related to #429312 (closed)