Skip to content

Aggregate project level releases metrics to the group

Krasimir Angelov requested to merge 208947-group-release-stats into master

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):

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)

Edited by Nathan Friend

Merge request reports