Skip to content

feat(issue-detection): Add weighted project selection#113466

Merged
roggenkemper merged 5 commits intomasterfrom
roggenkemper/feat/weighted-project-selection
Apr 21, 2026
Merged

feat(issue-detection): Add weighted project selection#113466
roggenkemper merged 5 commits intomasterfrom
roggenkemper/feat/weighted-project-selection

Conversation

@roggenkemper
Copy link
Copy Markdown
Member

the new scheduling in #113060 means that we needed a better way to pick which projects we are running detection on. Now we will build a shuffled playlist of 20 project IDs weighted by transaction traffic and cache it per org for 7 days. Each dispatch pops the next project off the list. When exhausted, regenerates from a fresh Snuba query.

roggenkemper and others added 2 commits April 20, 2026 15:02
Build a shuffled playlist of 20 project IDs weighted by transaction
traffic and cache it per org for 7 days. Each dispatch pops the next
project off the list. When exhausted, regenerates from a fresh Snuba
query. Falls back to random selection if no traffic data available.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…E_CHECKING

Use LPOP/RPUSH on Redis directly instead of Django cache for consistency
with the rest of the detection code. Also remove unnecessary TYPE_CHECKING
guard for Organization import.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Apr 20, 2026
Comment thread src/sentry/tasks/llm_issue_detection/detection.py Outdated
Comment thread src/sentry/tasks/llm_issue_detection/trace_data.py Outdated
Comment thread src/sentry/tasks/llm_issue_detection/trace_data.py Outdated
Comment thread src/sentry/tasks/llm_issue_detection/trace_data.py
Comment thread src/sentry/tasks/llm_issue_detection/trace_data.py
…et rebuild

- Guard second lpop against None from concurrent workers draining the list
- Handle Project.DoesNotExist for stale IDs from the 7-day playlist cache
- Move set(project_ids) outside dict comprehension

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@roggenkemper
Copy link
Copy Markdown
Member Author

bugbot run

Comment thread src/sentry/tasks/llm_issue_detection/trace_data.py Outdated
…to Redis

Avoids an unnecessary lpop round trip after building the playlist.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@roggenkemper
Copy link
Copy Markdown
Member Author

bugbot run

Copy link
Copy Markdown
Contributor

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit e491744. Configure here.

@roggenkemper roggenkemper marked this pull request as ready for review April 21, 2026 14:51
@roggenkemper roggenkemper requested a review from a team as a code owner April 21, 2026 14:51
Comment thread src/sentry/tasks/llm_issue_detection/trace_data.py Outdated
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@roggenkemper roggenkemper enabled auto-merge (squash) April 21, 2026 17:10
@roggenkemper roggenkemper merged commit c7703c3 into master Apr 21, 2026
55 checks passed
@roggenkemper roggenkemper deleted the roggenkemper/feat/weighted-project-selection branch April 21, 2026 17:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants