Skip to content

feat(explore): updates explore saved query serializer param to be an array#87503

Merged
edwardgou-sentry merged 3 commits into
masterfrom
egou/feat/explore-saved-query-serializer-support-multi-query
Mar 24, 2025
Merged

feat(explore): updates explore saved query serializer param to be an array#87503
edwardgou-sentry merged 3 commits into
masterfrom
egou/feat/explore-saved-query-serializer-support-multi-query

Conversation

@edwardgou-sentry

@edwardgou-sentry edwardgou-sentry commented Mar 20, 2025

Copy link
Copy Markdown
Contributor

Adds a new inner QuerySerializer to contain fields, orderby, groupby, query, visualize, and mode params.
Updates query in ExploreSavedQuerySerializer to now be a list of QuerySerializer.

This change is to provide support for saving Explore Multi Query views. Multiple queries in a Multi Query view is represented through multiple QuerySerializer entries. Single Explore Query views will be saved using a list with a single QuerySerializer element.

A migration isn't necessary for this change, because no changes were made to the model. Also, because the query attribute in the ExploreSavedQuery is already a JSONField, which supports storing lists.

ie the query column before:

{"query":"span.op:[pageload,navigation]","fields":["span.op","timestamp"],"orderby":"-timestamp","visualize":[{"chartType":1,"yAxes":["count(span.duration)"]}],"mode":"samples",...}

the query column after:

{"query":[{"query":"span.op:[pageload,navigation]","fields":["span.op","timestamp"],"orderby":"-timestamp","groupby":["span.op"],"visualize":[{"chartType":1,"yAxes":["avg(span.duration)"]}],"mode":"samples"}],...}

@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Mar 20, 2025
@codecov

codecov Bot commented Mar 20, 2025

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

✅ All tests successful. No failed tests found.

Additional details and impacted files
@@             Coverage Diff             @@
##           master   #87503       +/-   ##
===========================================
+ Coverage   45.07%   87.74%   +42.66%     
===========================================
  Files        9881     9899       +18     
  Lines      560636   561440      +804     
  Branches    22139    22119       -20     
===========================================
+ Hits       252714   492640   +239926     
+ Misses     307520    68396   -239124     
- Partials      402      404        +2     

@edwardgou-sentry edwardgou-sentry force-pushed the egou/feat/explore-saved-query-serializer-support-multi-query branch from 0649360 to c4822a8 Compare March 20, 2025 19:38
@edwardgou-sentry edwardgou-sentry marked this pull request as ready for review March 21, 2025 17:02
@edwardgou-sentry edwardgou-sentry requested review from a team March 21, 2025 17:02
Comment thread src/sentry/explore/endpoints/serializers.py
@edwardgou-sentry edwardgou-sentry merged commit 8fa52e8 into master Mar 24, 2025
@edwardgou-sentry edwardgou-sentry deleted the egou/feat/explore-saved-query-serializer-support-multi-query branch March 24, 2025 16:07
andrewshie-sentry pushed a commit that referenced this pull request Mar 27, 2025
…array (#87503)

Adds a new inner `QuerySerializer` to contain `fields`, `orderby`,
`groupby`, `query`, `visualize`, and `mode` params.
Updates `query` in `ExploreSavedQuerySerializer` to now be a list of
`QuerySerializer`.

This change is to provide support for saving Explore Multi Query views.
Multiple queries in a Multi Query view is represented through multiple
`QuerySerializer` entries. Single Explore Query views will be saved
using a list with a single `QuerySerializer` element.
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 9, 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