Skip to content

feat(weekly-report): Use recommended sort v1 to find top issues#118605

Draft
amy-chen23 wants to merge 3 commits into
masterfrom
amyc/rec-sort-weekly-report
Draft

feat(weekly-report): Use recommended sort v1 to find top issues#118605
amy-chen23 wants to merge 3 commits into
masterfrom
amyc/rec-sort-weekly-report

Conversation

@amy-chen23

@amy-chen23 amy-chen23 commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Resolves -----

Summary

  • Replace the "top 3 issues by event count" approach with the recommended sort v1 algorithm (pure ClickHouse scoring) to find the top 5 issues for the weekly email report
  • Use custom weights tuned for a weekly digest: heavier on event volume (0.40) and severity (0.30), lighter on recency (0.10), with spike zeroed out (not meaningful for a 7-day window — it measures a 6h/3d ratio at query time)
  • Weights are registered as weekly-report.recommended.* options so they can be tuned via automator independently of the issue stream weights
  • Add weight_overrides parameter to _recommended_aggregation() so the weekly report can pass its own weights without duplicating the ClickHouse expression logic
  • Gated behind organizations:weekly-report-recommended-sort feature flag

Changes

  • src/sentry/options/defaults.py — register 4 weekly report weight options
  • src/sentry/search/snuba/executors.py — add weight_overrides param to _recommended_aggregation()
  • src/sentry/tasks/summaries/utils.py — build candidates using _recommended_aggregation with weekly report weights
  • src/sentry/tasks/summaries/organization_report_context_factory.py — populate candidates behind feature flag
  • src/sentry/tasks/summaries/weekly_reports.py — simplify render path: use ClickHouse base_score directly, drop v2 reranking
  • src/sentry/templates/sentry/emails/reports/body.html — conditional header: "Top issues for you" vs "Issues with the most errors"
  • src/sentry/features/temporary.py — register feature flag
  • src/sentry/snuba/referrer.py — add REPORTS_RECOMMENDED_ISSUES referrer
  • tests/sentry/tasks/test_weekly_reports.py — 4 tests covering flag on/off, candidate ordering, template rendering

Test plan

  • pytest -k recommended_sort tests/sentry/tasks/test_weekly_reports.py — 4 pass
  • Enable flag for a test org, trigger weekly report, verify top 5 issues appear with "Top issues for you" header
  • Verify flag-off path still shows "Issues with the most errors" with event-count ordering

@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Jun 26, 2026
@amy-chen23 amy-chen23 changed the title feat(weekly-report): Implement modified rec-sort for "Recommended Issues" section feat(weekly-report): use recommended sort v1 to find top issues Jun 26, 2026
@amy-chen23 amy-chen23 changed the title feat(weekly-report): use recommended sort v1 to find top issues feat(weekly-report): Use recommended sort v1 to find top issues Jun 26, 2026
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.

1 participant