Skip to content

Return group information on Project endpoint

Mayra Cabrera requested to merge 39858-add-group-owned-info-to-projects-api into master

What does this MR do?

Returns extra group information (web_url and avatar_url) on /projects/:id/ endpoint

Does this MR meet the acceptance criteria?


Performance and testing

If cross-browser testing is not required, please remove the relevant item, or mark it as not needed: [-] -->

Manual QA

Projects with User namespace

❯ curl --header "Private-Token: $ROOT_TOKEN"
  "id": 32,
  "name": "project-user",
  "name_with_namespace": "Administrator / project-user",
  "path": "project-user",
  "path_with_namespace": "root/project-user",
  "namespace": {
    "id": 1,
    "name": "root",
    "path": "root",
    "kind": "user",
    "full_path": "root",
    "parent_id": null,
    "avatar_url": "",
    "web_url": ""

Projects with Group namespace

❯ curl --header "Private-Token: $ROOT_TOKEN"
  "id": 33,
  "name": "project-group",
  "name_with_namespace": "gitlab-group / project-group",
  "path": "project-group",
  "namespace": {
    "id": 73,
    "name": "gitlab-group",
    "path": "gitlab-group",
    "kind": "group",
    "full_path": "gitlab-group",
    "parent_id": null,
    "web_url": "",
    "avatar_url": null


Calling project/:id, with a group-owned project and a user-owned project, and group/:id/ endpoints, 1_000 times:

Performance on master

       user     system      total        real
group-project  0.601027   0.173727   0.774754 (152.476797)
user-project  0.594288   0.170085   0.764373 (151.239069)
group-endpoint  0.582715   0.167289   0.750004 (101.568693)

Performance on this branch

      user     system      total        real
group-project  0.595221   0.175348   0.770569 (150.786741)
user-project  0.596732   0.175914   0.772646 (150.369293)
group-endpoint  0.582041   0.171045   0.753086 (100.946703)

Timings are similar so my take is API performance is not decreased with this change.

Another benefit of this change:

  • By aggregating this data to own of our one most visited endpoints (projects/:id), we're decreasing the excessive number of API requests made by external integrations that depend on our API. GitKraken is an example of this, currently needs to do an extra call to get the group information:

Closes #39858 (closed)

Edited by Mayra Cabrera

Merge request reports