Support analytics aggregation without explicit sources at organization level
What does this MR do and why?
At organization level, the analytics aggregation GraphQL API required explicit groupFullPaths or projectFullPaths. To get a cross-group view, a caller had to list every group by hand.
Now descendantsScope is optional at organization level:
- Organization owners and administrators on GitLab Self-Managed and GitLab Dedicated aggregate the whole instance, including records without a group or project.
- All other users, including every user on GitLab.com, aggregate all top-level groups where they can read that analytics type. The limit is 20 groups. For Duo Agent Platform flows, the API skips top-level groups that turned Duo Agent Platform off.
References
Screenshots or screen recordings
Not applicable: API-only change.
How to set up and validate locally
-
Make sure ClickHouse is set up for analytics in GDK and has some data.
-
Sign in as an administrator and turn on admin mode (if admin mode is enabled).
-
Run this query in GraphiQL (
http://127.0.0.1:3000/-/graphql-explorer):query { organization { analytics { deployments { aggregated { nodes { totalCount } } } } } } -
Confirm that the result covers every group of the instance.
-
Run the same query as a user who is not an organization owner. Confirm that the result covers only the top-level groups where this user has Reporter access or higher.
-
Run the same query as a user without such groups. Confirm that the API returns "No top-level groups with accessible analytics found".
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.