Aggregate project level releases metrics to the group
What does this MR do?
Adds two new statistics to the group entity:
releases_count
releases_percentage
and exposes these data points through GraphQL.
Database
The queries executed to calculate these stats (for https://gitlab.com/gitlab-org group):
- Count all releases in group (and descendants) - https://postgres.ai/console/shared/c414370a-cd3b-4568-b103-7d8f306d7831
- % of projects with releases in group (and descendants) - https://explain.depesz.com/s/KPGD
Example query/response
The query below was ran against the following group/project structure:
.
└── Group 1 ("releases-group")
├── Project 1
│ └── Release 1
└── Group 2
├── Project 2
│ ├── Release 2
│ └── Release 3
└── Project 3
Query:
{
group(fullPath: "releases-group") {
stats {
releaseStats {
releasesCount
releasesPercentage
}
}
}
}
Response:
{
"data": {
"group": {
"stats": {
"releaseStats": {
"releasesCount": 3,
"releasesPercentage": 67
}
}
}
}
}
Permissions
In order to access the release statistics, the user must have Guest permissions or higher in the group, regardless of the group's visibility (public or private). For example, an unauthenticated user running the query above against a public group will get the following response:
{
"data": {
"group": {
"stats": {
"releaseStats": null
}
}
}
}
Feature flag
The two GraphQL fields introduced by this MR are hidden behind a group_level_release_statistics
feature flag, which is enabled by default.
Rollout issue: #283962 (closed)
When the feature flag is disabled, the fields are still query-able, but they will always return null
:
{
"data": {
"group": {
"stats": {
"releaseStats": {
"releasesCount": null,
"releasesPercentage": null
}
}
}
}
}
Related to #208947 (closed)