Skip to content

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
image image (feature flag enabled)
image (feature flag disabled)

How to set up and validate locally

  1. Requires GitLab Ultimate.
  2. Follow these instructions to set up Product Analytics in your GDK.
  3. Enable product analytics
  4. Onboard a project with product analytics and generate some events
  5. Visit a group -> Settings -> Usage Quota
  6. Verify group totals chart displays 2 months worth of data
  7. echo "Feature.enable(:product_analytics_usage_quota_annual_data)" | gdk rails c
  8. 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.

Related to #429312 (closed)

Edited by Elwyn Benson

Merge request reports