Repository navigation
fix(tempo): page through all teams in the teams API and scope search - #9321
Open
ShivamSharma43 wants to merge 1 commit into
Open
ShivamSharma43 wants to merge 1 commit into
ShivamSharma43 wants to merge 1 commit into
Conversation
GetTeams decoded the GET /4/teams response into a slice, but Tempo v4 returns a page object (self, metadata, results), so GET /plugins/tempo/connections/:id/teams always failed with "failed to unmarshal teams response". searchTempoRemoteTeams sent a single request without offset/limit, so it only searched the first 50 teams returned. Add listAllTempoTeams, which follows metadata.next through every page, and use it in both. Closes apache#9320 Generated-by: Claude Code (Claude Opus 5.5) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Shivam Sharma <192242476+ShivamSharma43@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two places in
backend/plugins/tempo/apireadGET /4/teamswith a single request:GetTeams(GET /plugins/tempo/connections/{id}/teams) decoded the response into[]models.TempoTeamResponse. Tempo v4 returns a page object (PageableTeam:self,metadata,results), so the endpoint always failed withfailed to unmarshal teams response. Even with the right type, it would only have returned the first page.searchTempoRemoteTeams(search-remote-scopes) sent oneGET /4/teams?name=...withoutoffset/limit, so it only searched the first 50 teams the API returned (Tempo's defaultlimit). Itspage/pageSizepaging then worked on that truncated list.Changes:
api/remote.go: newlistAllTempoTeamshelper. It pages throughGET /4/teamswithoffset/limit(keeping the caller's query, e.g.name) untilmetadata.nextis absent, the same pagination signallistTempoRemoteTeamshas used since fix(tempo): paginate teams with metadata.next instead of a missing total #9307.searchTempoRemoteTeamsuses it; its filtering and paging are unchanged.api/connection.go:GetTeamsuses the same helper.api/remote_test.go: the fake client can serve a body peroffsetand records every query. New testsTestListAllTempoTeams(followsnext, keeps thenamefilter, stops on the last page) andTestSearchTempoRemoteTeamsSearchesEveryPage(finds a match on the second API page; fails onmain).No model, migration or API-surface changes.
Does this close any open issues?
Closes #9320
Screenshots
N/A
Other Information
go test ./plugins/tempo/api/ ./plugins/tempo/tasks/and the tempo e2e tests (E2E_DB_URLon a local PostgreSQL 18): pass.go vet,gofmtandgolangci-lint run ./plugins/tempo/...: clean.pr-type/bug-fix.Generated-by:trailer per the ASF generative tooling guidance.🤖 Generated with Claude Code