Skip to content

fix(tempo): only collect and extract the team of a team scope - #9319

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

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

Conversation

@ShivamSharma43

Copy link
Copy Markdown
Contributor

Summary

_tool_tempo_teams is both the scope table and the output of extract_teams, but the team subtasks worked on the whole connection: collect-teams fetched every team of the Tempo instance with raw params {"ConnectionId":1,"TeamId":0}, and extract_teams turned each one into a TempoTeam with ScopeConfigId 0. The extractor's batch save deletes rows with the same raw params before inserting, so one team scope's pipeline re-created every team scope of the connection:

  • teams that were never selected became data scopes of the connection;
  • the selected team scopes lost their scope config (scope_config_id reset to 0);
  • a team scope deleted from the connection came back on the next run.

Changes (backend/plugins/tempo/tasks):

  • team_collector.go: raw params are now {ConnectionId, TeamId}, matching TempoTeam.ScopeParams() and the worklog collector, so extracting one team scope only replaces that team's row. The request filters on the scope's team with teamIds. The updatedFrom parameter is dropped because GET /4/teams doesn't support it (the Tempo OpenAPI spec lists offset, limit, teamMembers, name, teamIds). The collector is now a plain ApiCollector, so each run replaces the raw rows; before, an incremental run fetched all teams again and appended them.
  • team_extractor.go: skips teams other than the scope's team (when teamId is set) and keeps the scope_config_id of existing team scopes.
  • Without a teamId option (plain connection-level task), all teams are still collected and extracted, as before.

Rows that earlier runs added with the old connection-wide params are left untouched (they can't be told apart from scopes the user added on purpose), so no migration. Users can remove the unwanted teams from the connection's data scopes, and they won't come back.

Does this close any open issues?

Closes #9318

Screenshots

N/A

Other Information

  • New unit tests: TestBuildTeamQuery (teamIds set, no updatedFrom) and TestExtractTeam (other teams skipped, scope config kept).
  • New e2e test TestTeamScopeExtraction: two team scopes with scope configs, team 71 extracted. Team 71 is refreshed and keeps scope_config_id = 3, and team 17 is untouched. It fails on main.
  • go test ./plugins/tempo/... and the tempo e2e tests (E2E_DB_URL on a local PostgreSQL 18): pass. go vet, gofmt and golangci-lint run ./plugins/tempo/...: clean.
  • Related: [Bug][Tempo] Ingestion issue on teams #9284 / fix(tempo): change team summary column to text #9303 (team summary longer than 255 characters). That PR touches different files. Since only the scope's own team is extracted now, a long summary on some other team no longer breaks extract_teams.
  • 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

collect-teams fetched every team of the Tempo instance with
connection-wide raw params, and extract_teams turned each of them into
a TempoTeam scope with ScopeConfigId 0. Since the batch save deletes
rows by raw params first, one team scope's pipeline re-created every
team scope of the connection: teams that were never selected became
scopes and the selected ones lost their scope config.

- Scope the team raw data and extracted rows per team ({ConnectionId,
  TeamId}, like TempoTeam.ScopeParams and the worklog collector).
- collect-teams: request only the scope's team with teamIds, and drop
  the updatedFrom filter, which GET /4/teams doesn't support, along
  with the incremental collector state, so each run replaces the raw
  rows instead of appending them again.
- extract_teams: skip other teams and keep the existing scope config.

Closes apache#9318

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:20

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.

@klesh
klesh merged commit ac0c402 into apache:main Nov 6, 2026
10 checks passed
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] A team scope's pipeline adds every Tempo team as a scope and resets their scope config

3 participants