perf(issue-list): use collapse parameter to skip unused Snuba queries#545
Merged
perf(issue-list): use collapse parameter to skip unused Snuba queries#545
Conversation
Contributor
Semver Impact of This PR🟢 Patch (bug fixes) 📋 Changelog PreviewThis is how your changes will appear in the changelog. New Features ✨
Internal Changes 🔧Coverage
Other
🤖 This preview updates automatically when you update the PR. |
Contributor
Codecov Results 📊✅ 126 passed | Total: 126 | Pass Rate: 100% | Execution Time: 0ms 📊 Comparison with Base Branch
✨ No test changes detected All tests are passing successfully. ✅ Patch coverage is 100.00%. Project has 1028 uncovered lines. Files with missing lines (2)
Coverage diff@@ Coverage Diff @@
## main #PR +/-##
==========================================
+ Coverage 96.04% 96.04% —%
==========================================
Files 186 186 —
Lines 25897 25929 +32
Branches 0 0 —
==========================================
+ Hits 24869 24901 +32
- Misses 1028 1028 —
- Partials 0 0 —Generated by Codecov Action |
The Sentry web UI optimizes issue list loading by sending collapse
parameters to /organizations/{org}/issues/, telling the server to
skip computing data the client won't use. This avoids expensive
Snuba/ClickHouse queries and saves 200-500ms per API request.
The CLI's issue list command never consumes filtered, lifetime, or
unhandled fields — these are always collapsed. The stats field
(sparkline data for the TREND column) is conditionally collapsed
when sparklines won't be rendered: JSON mode, narrow terminals
(<100 cols), and non-TTY output.
When stats are collapsed, groupStatsPeriod is also omitted since
the server won't compute stats anyway.
Changes:
- Add IssueCollapseField type and buildIssueListCollapse() to API layer
- Add collapse parameter to listIssuesPaginated/listIssuesAllPages
- Add willShowTrend() helper to formatters (avoids process.stdout in commands)
- Thread collapse through fetchIssuesForTarget, fetchWithBudget, fetchOrgAllIssues
- Property tests for buildIssueListCollapse invariants
- Integration tests verifying collapse reaches the API
93e846f to
4da341b
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
- Remove ?? 'auto' fallback in fetchIssuesForTarget so intentional undefined from buildListApiOptions flows through (Seer) - Refactor writeIssueTable to call willShowTrend() instead of duplicating the terminal width check inline (Bugbot)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

The Sentry web UI optimizes issue list loading by sending
collapseparameters to/organizations/{org}/issues/, telling the server to skip computing data the client won't use. This avoids expensive Snuba/ClickHouse queries and saves 200-500ms per API request.What gets collapsed
filteredlifetimecount/userCount, notlifetimeunhandledissue view, notissue liststatsWhen stats are collapsed,
groupStatsPeriodis also omitted since the server won't compute stats anyway.Changes
IssueCollapseFieldtype andbuildIssueListCollapse()pure function to the API layercollapseparameter tolistIssuesPaginated/listIssuesAllPageswillShowTrend()helper to formatters (keepsprocess.stdoutout of command files)fetchIssuesForTarget,fetchWithBudget,fetchOrgAllIssuesbuildIssueListCollapseinvariantsContext
Investigation of the Sentry backend showed the
/issues/endpoint uses a dual-database (PostgreSQL + Snuba) pipeline. Eachcollapsevalue skips a round of Snuba queries in theStreamGroupSerializerSnubaserializer. The Discover endpoint (/events/?dataset=errors) cannot replace issue listing since issues are aggregations above events.