Skip to content

fix(tempo): paginate teams with metadata.next instead of a missing total - #9307

Merged
klesh merged 1 commit into
apache:mainfrom
ShivamSharma43:fix/tempo-team-pagination
Nov 3, 2026
Merged

klesh merged 1 commit into
apache:mainfrom
ShivamSharma43:fix/tempo-team-pagination

Conversation

@ShivamSharma43

Copy link
Copy Markdown
Contributor

Summary

Tempo team pagination read metadata.total, but GET /4/teams doesn't return a total (its metadata is PageableMetadata = count, limit, next, offset, previous per the Tempo OpenAPI spec). total unmarshalled as 0, so only the first 50 teams were ever reached. This is the same root cause as #9163, which #9164 fixed for worklogs only.

Changes:

  • api/remote.go listTempoRemoteTeams: return a next page when metadata.next is set, instead of offset + limit < total (always false). The data scope picker now lists teams beyond the first 50.
  • tasks/team_collector.go: drop GetTotalPages (it returned 0, so the collector stopped after page 1). The collector now uses the helper's undetermined mode and fetches pages until one comes back short, like the worklog collector after fix(tempo): paginate worklog collection, honour the sync range, and emit ids that join jira #9164.
  • api/remote_test.go: new unit test for the remote listing: follows next with the right offset, stops on the last page (no next).

No model, migration or API-surface changes (so no swagger regeneration).

Does this close any open issues?

Closes #9306

Screenshots

N/A

Other Information

  • go build / go vet / gofmt clean for ./plugins/tempo/....
  • go test ./plugins/tempo/api/ ./plugins/tempo/tasks/: pass. The new test fails on main (nextPage is nil on the first page).
  • plugins/tempo/e2e needs a live E2E_DB_URL database, which I didn't run locally; the team extractor e2e is unaffected by this change (it only reads raw rows).
  • 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

Tempo v4 GET /4/teams returns PageableMetadata (count, limit, offset,
next, previous) without a total, so metadata.total unmarshalled as 0:

- listTempoRemoteTeams never returned a next page, so the data scope
  picker only listed the first 50 teams; follow metadata.next instead.
- CollectTeams' GetTotalPages returned 0, so only the first page of
  teams was collected; drop it so the collector fetches pages until one
  comes back short, like the worklog collector.

Closes apache#9306

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 2, 2026 12:32

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.

@klesh klesh 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.

LGTM

Thanks for your contribution.

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] Team pagination relies on metadata.total, which Tempo v4 doesn't return: only the first 50 teams are listed/collected

3 participants