Return group information on Project endpoint
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?
Conformity
- [-] Changelog entry
-
Documentation created/updated or follow-up review issue created -
Code review guidelines -
Merge request performance guidelines -
Style guides - [-] Database guides
- [-] Separation of EE specific content
Performance and testing
If cross-browser testing is not required, please remove the relevant item, or mark it as not needed: [-] -->
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. - [-] Tested in all supported browsers
Manual QA
Projects with User
namespace
❯ curl --header "Private-Token: $ROOT_TOKEN" http://192.168.15.4:3000/api/v4/projects/32
{
"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": "https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
"web_url": "http://192.168.15.4:3000/root"
},
}
Projects with Group
namespace
❯ curl --header "Private-Token: $ROOT_TOKEN" http://192.168.15.4:3000/api/v4/projects/33
{
"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": "http://192.168.15.4:3000/groups/gitlab-group",
"avatar_url": null
},
}
Benchmarks
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: https://gitlab.com/gitlab-com/gl-infra/infrastructure/issues/4569
Closes #39858 (closed)
Edited by Mayra Cabrera