Skip to content

fix(tempo): page through all teams in the teams API and scope search - #9321

Open
ShivamSharma43 wants to merge 1 commit into
apache:mainfrom
ShivamSharma43:fix/tempo-teams-api
Open

ShivamSharma43 wants to merge 1 commit into
apache:mainfrom
ShivamSharma43:fix/tempo-teams-api

Conversation

@ShivamSharma43

Copy link
Copy Markdown
Contributor

Summary

Two places in backend/plugins/tempo/api read GET /4/teams with 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 with failed to unmarshal teams response. Even with the right type, it would only have returned the first page.
  • searchTempoRemoteTeams (search-remote-scopes) sent one GET /4/teams?name=... without offset/limit, so it only searched the first 50 teams the API returned (Tempo's default limit). Its page/pageSize paging then worked on that truncated list.

Changes:

  • api/remote.go: new listAllTempoTeams helper. It pages through GET /4/teams with offset/limit (keeping the caller's query, e.g. name) until metadata.next is absent, the same pagination signal listTempoRemoteTeams has used since fix(tempo): paginate teams with metadata.next instead of a missing total #9307. searchTempoRemoteTeams uses it; its filtering and paging are unchanged.
  • api/connection.go: GetTeams uses the same helper.
  • api/remote_test.go: the fake client can serve a body per offset and records every query. New tests TestListAllTempoTeams (follows next, keeps the name filter, stops on the last page) and TestSearchTempoRemoteTeamsSearchesEveryPage (finds a match on the second API page; fails on main).

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_URL on a local PostgreSQL 18): pass. go vet, gofmt and golangci-lint run ./plugins/tempo/...: clean.
  • Independent of fix(tempo): only collect and extract the team of a team scope #9319 (team collector/extractor, different files).
  • Suggested label: pr-type/bug-fix.
  • AI assistance disclosure: this change was prepared with the help of Claude Code (Claude Opus 5.5); I reviewed the diff and the Tempo API spec it relies on. The commit carries a Generated-by: trailer per the ASF generative tooling guidance.

🤖 Generated with Claude Code

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>
Copilot AI balanced review requested due to automatic review settings November 3, 2026 13:25

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug][Tempo] GET /connections/{id}/teams always fails to decode the teams page, and remote scope search only sees the first 50 teams

2 participants