-
Notifications
You must be signed in to change notification settings - Fork 250
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: use keyset pagination for retrieving project CI jobs #744
feat: use keyset pagination for retrieving project CI jobs #744
Conversation
Bumps [github.com/xanzy/go-gitlab](https://github.com/xanzy/go-gitlab) from 0.92.3 to 0.94.0. - [Changelog](https://github.com/xanzy/go-gitlab/blob/main/releases_test.go) - [Commits](xanzy/go-gitlab@v0.92.3...v0.94.0) --- updated-dependencies: - dependency-name: github.com/xanzy/go-gitlab dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]>
With xanzy/go-gitlab#1827, go-gitlab now supports keyset pagination, which is much more efficient for iterating through many pages of data. This commit switches the GitLab CI `/api/v4/projects/:id/jobs` API to use keyset pagination. The other pipeline API endpoints need keyset pagination support: https://gitlab.com/gitlab-org/gitlab/-/issues/431632
050ea5c
to
7ac3e79
Compare
@mvisonneau Could you review this? We're seeing a high amount of traffic on GitLab.com using offset pagination for |
Thanks a ton @stanhu! Do you know if there are additional calls that could benefit from it? |
also, do you know from which GitLab's version this feature is available? |
Good question. According to the documentation, GitLab 15.9 is required. Perhaps we need a way to switch between pagination modes, depending on what version is being used?
It looks like this exporter uses:
|
yeah, perhaps we could dynamically enable it depending on the version we can preliminary fetch (& most likely cache) from the Metadata API, wdyt? I believe we can do that in a follow up PR introducing the feature as well for |
mvisonneau#744 switched to keyset pagination for the `/api/v4/projects/:id/jobs` API endpoint, but this feature is only available in GitLab 15.9 and later (https://docs.gitlab.com/ee/api/jobs.html#list-project-jobs). This commit retrieves the instance metadata at startup to determine whether keyset pagination is available. If the metadata is not available or returns a version < 15.9, offset pagination will be used.
mvisonneau#744 switched to keyset pagination for the `/api/v4/projects/:id/jobs` API endpoint, but this feature is only available in GitLab 15.9 and later (https://docs.gitlab.com/ee/api/jobs.html#list-project-jobs). This commit retrieves the instance metadata at startup to determine whether keyset pagination is available. If the metadata is not available or returns a version < 15.9, offset pagination will be used.
mvisonneau#744 switched to keyset pagination for the `/api/v4/projects/:id/jobs` API endpoint, but this feature is only available in GitLab 15.9 and later (https://docs.gitlab.com/ee/api/jobs.html#list-project-jobs). This commit retrieves the instance metadata at startup to determine whether keyset pagination is available. If the metadata is not available or returns a version < 15.9, offset pagination will be used.
Sounds good! See #755. |
mvisonneau#744 switched to keyset pagination for the `/api/v4/projects/:id/jobs` API endpoint, but this feature is only available in GitLab 15.9 and later (https://docs.gitlab.com/ee/api/jobs.html#list-project-jobs). This commit retrieves the instance metadata at startup to determine whether keyset pagination is available. If the metadata is not available or returns a version < 15.9, offset pagination will be used.
mvisonneau#744 switched to keyset pagination for the `/api/v4/projects/:id/jobs` API endpoint, but this feature is only available in GitLab 15.9 and later (https://docs.gitlab.com/ee/api/jobs.html#list-project-jobs). This commit retrieves the instance metadata at startup to determine whether keyset pagination is available. If the metadata is not available or returns a version < 15.9, offset pagination will be used.
mvisonneau#744 switched to keyset pagination for the `/api/v4/projects/:id/jobs` API endpoint, but this feature is only available in GitLab 15.9 and later (https://docs.gitlab.com/ee/api/jobs.html#list-project-jobs). This commit retrieves the instance metadata at startup to determine whether keyset pagination is available. If the metadata is not available or returns a version < 15.9, offset pagination will be used.
* fix: use keyset pagination only when it is supported #744 switched to keyset pagination for the `/api/v4/projects/:id/jobs` API endpoint, but this feature is only available in GitLab 15.9 and later (https://docs.gitlab.com/ee/api/jobs.html#list-project-jobs). This commit retrieves the instance metadata at startup to determine whether keyset pagination is available. If the metadata is not available or returns a version < 15.9, offset pagination will be used. * chore: Use golang.org/x/mod/semver for version parsing
With xanzy/go-gitlab#1827, go-gitlab now supports keyset pagination, which is much more efficient for iterating through many pages of data. This commit switches the GitLab CI
/api/v4/projects/:id/jobs
API to use keyset pagination.The other pipeline API endpoints need keyset pagination support: https://gitlab.com/gitlab-org/gitlab/-/issues/431632