Skip to content

feat(explore): Adds prebuilt queries to Explore#90720

Merged
edwardgou-sentry merged 7 commits into
masterfrom
egou/feat/explore-prebuilt-queries
May 6, 2025
Merged

feat(explore): Adds prebuilt queries to Explore#90720
edwardgou-sentry merged 7 commits into
masterfrom
egou/feat/explore-prebuilt-queries

Conversation

@edwardgou-sentry

@edwardgou-sentry edwardgou-sentry commented May 1, 2025

Copy link
Copy Markdown
Contributor

Adds prebuilt queries to Explore:

  • PREBUILT_SAVED_QUERIES are saved as hardcoded dicts in explore_saved_queries.py.

  • On the first time GET is called on ExploreSavedQueriesEndpoint, we insert PREBUILT_SAVED_QUERIES entries into the saved queries db table, if they do not already exist. We also update or delete saved prebuilt queries in the db if there are changes detected (see sync_prebuilt_queries).

  • If it's the first time a user is fetching prebuilt queries, we also "star" them for the user by default. See sync_prebuilt_queries_starred.

  • This allows users to (mostly) interact with prebuilt queries in the same way as user generated saved queries (ie star, reorder star position, search filter, search sort, duplicate, etc). This also allows Sentry to add, change, or delete any prebuilt queries in the future. We do not allow users to delete or edit prebuilt queries.

@github-actions github-actions Bot added Scope: Frontend Automatically applied to PRs that change frontend components Scope: Backend Automatically applied to PRs that change backend components labels May 1, 2025
@edwardgou-sentry edwardgou-sentry force-pushed the egou/feat/explore-prebuilt-queries branch from e978b34 to 6b1123c Compare May 1, 2025 01:52
@getsentry getsentry deleted a comment from github-actions Bot May 1, 2025
@codecov

codecov Bot commented May 1, 2025

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 71.96970% with 37 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...ry/explore/endpoints/test_explore_saved_queries.py 71.08% 24 Missing ⚠️
.../sentry/explore/endpoints/explore_saved_queries.py 82.50% 7 Missing ⚠️
...y/explore/endpoints/explore_saved_query_starred.py 0.00% 4 Missing ⚠️
...ry/explore/endpoints/explore_saved_query_detail.py 50.00% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           master   #90720       +/-   ##
===========================================
+ Coverage   32.90%   78.01%   +45.11%     
===========================================
  Files        8716    10296     +1580     
  Lines      485775   584012    +98237     
  Branches    22588    22528       -60     
===========================================
+ Hits       159822   455607   +295785     
+ Misses     325529   127991   -197538     
+ Partials      424      414       -10     

@edwardgou-sentry edwardgou-sentry requested review from a team May 1, 2025 03:08
@edwardgou-sentry edwardgou-sentry marked this pull request as ready for review May 1, 2025 03:08
@edwardgou-sentry edwardgou-sentry requested a review from a team as a code owner May 1, 2025 03:08
@edwardgou-sentry edwardgou-sentry changed the base branch from master to egou/feat/explore-prebuilt-saved-queries-model-changes May 5, 2025 14:29
@edwardgou-sentry edwardgou-sentry force-pushed the egou/feat/explore-prebuilt-queries branch from ab6a17b to ac82a58 Compare May 5, 2025 14:31
@edwardgou-sentry edwardgou-sentry removed the request for review from a team May 5, 2025 14:31
@getsentry getsentry deleted a comment from github-actions Bot May 5, 2025
@edwardgou-sentry

Copy link
Copy Markdown
Contributor Author

Moved db migrations to the following pr for easier review

Comment thread src/sentry/explore/endpoints/explore_saved_queries.py Outdated
Base automatically changed from egou/feat/explore-prebuilt-saved-queries-model-changes to master May 5, 2025 17:29
Co-authored-by: Nar Saynorath <nar.saynorath@sentry.io>
@edwardgou-sentry edwardgou-sentry merged commit e82749d into master May 6, 2025
@edwardgou-sentry edwardgou-sentry deleted the egou/feat/explore-prebuilt-queries branch May 6, 2025 15:49
@sentry

sentry Bot commented May 7, 2025

Copy link
Copy Markdown
Contributor

Suspect Issues

This pull request was deployed and Sentry observed the following issues:

  • ‼️ AssertionError: assert [455602990088...6029900881922] == [455602990088...6029900881923] pytest.runtest.protocol tests/sentry/explore/en... View Issue

Did you find this useful? React with a 👍 or 👎

andrewshie-sentry pushed a commit that referenced this pull request May 12, 2025
Adds prebuilt queries to Explore:
- `PREBUILT_SAVED_QUERIES` are saved as hardcoded dicts in
`explore_saved_queries.py`.

- On the first time `GET` is called on `ExploreSavedQueriesEndpoint`, we
insert `PREBUILT_SAVED_QUERIES` entries into the saved queries db table,
if they do not already exist. We also update or delete saved prebuilt
queries in the db if there are changes detected (see
`sync_prebuilt_queries`).

- If it's the first time a user is fetching prebuilt queries, we also
"star" them for the user by default. See
`sync_prebuilt_queries_starred`.

- This allows users to (mostly) interact with prebuilt queries in the
same way as user generated saved queries (ie star, reorder star
position, search filter, search sort, duplicate, etc). This also allows
Sentry to add, change, or delete any prebuilt queries in the future. We
do not allow users to delete or edit prebuilt queries.
@github-actions github-actions Bot locked and limited conversation to collaborators May 22, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

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