Extend total group usage visualization from 2 months to full year
Follows on from Add product analytics usage visualization to sh... (#424153 - closed)
In the previous issue, the groups total usage is visualized using the existing data the client has available (current + previous months).
We can extend that functionality and modify the query to return 12 months of data for each project, and display a years worth of data on the chart at once. This matches the other existing usage quota pages, e.g.
We can also clean up the duplicated query/code introduced in Add product analytics monthly group usage chart (!135536 - merged)
To verify
Ensure the performance impact is fine, since behind the scenes it will query 12 individual months per project, which could get expensive.
Implementation plan
-
Modify backend GraphQL resolver + types
- Instead of querying for a single month of data, input is an array of year/month selections to query
- Instead of returning an Int count, return an array of
{year, month, count}
- Simplify the query to not be specific to current+previous months and take array of month selections
- Resolver still gets counts for individual months as supported by configurator, in a loop
- Resolver would no longer default to the current months usage, and requires a specific month selection
- Example implementation: graphql-usage-changes.patch
-
Modify frontend to consume updated GraphQL endpoint
- Modify query variables to pass array of
{ year, month }
to fetch - Simplify response mapping code, since return type is now a single project with an array of monthly usages on it (no need to combine separate arrays of previous + current months projects) (this format can basically be passed directly to chart components)
- modify group totals component to request 12 months of data instead of 2
- Modify query variables to pass array of
-
Update documentation
-
Update tests