Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(rpc): Allow filtering when we can't use VirtualColumnContexts #83663

Merged
merged 8 commits into from
Jan 23, 2025

Conversation

wmak
Copy link
Member

@wmak wmak commented Jan 17, 2025

  • VirtualColumnContexts aren't available on timeseries, so if we filter by a vcc field (project, device.class) we need custom logic
  • From a discussion in slack going to drop device.module support, will do that in a follow up PR

@wmak wmak requested a review from a team as a code owner January 17, 2025 18:54
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Jan 17, 2025
Copy link

codecov bot commented Jan 17, 2025

Codecov Report

Attention: Patch coverage is 92.17391% with 9 lines in your changes missing coverage. Please review.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/sentry/search/eap/resolver.py 80.43% 9 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #83663      +/-   ##
==========================================
+ Coverage   87.23%   87.64%   +0.41%     
==========================================
  Files        9530     9530              
  Lines      542683   545711    +3028     
  Branches    21259    21259              
==========================================
+ Hits       473390   478296    +4906     
+ Misses      68926    67048    -1878     
  Partials      367      367              

Comment on lines 357 to 365
# Convert the resolved_column to the underlying column
if term.key.name in constants.PROJECT_FIELDS:
resolved_column, _ = self.resolve_attribute("project.id")
if isinstance(final_raw_value, list):
final_raw_value = [int(val) for val in final_raw_value]
else:
final_raw_value = int(final_raw_value)
elif term.key.name == "device.class":
resolved_column, _ = self.resolve_attribute("sentry.device.class")
Copy link
Member

Choose a reason for hiding this comment

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

This will conflict with #83714 where you're trying to make the search resolver applicable to different datasets.

Copy link
Member Author

Choose a reason for hiding this comment

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

😬 ugh right... I'll move this logic to the VCC definitions instead then and merge 83714 first

Comment on lines +335 to +340
if context.default_value and context.default_value == raw_iterable:
# Avoiding this for now, while this could work with the Unknown:"" mapping
# But that won't work once we use the VirtualColumnContext.default_value
raise InvalidSearchQuery(
f"Using {raw_iterable} in an IN filter is not currently supported"
)
Copy link
Member

Choose a reason for hiding this comment

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

Why is the default value special when used in an IN filter?

Copy link
Member Author

Choose a reason for hiding this comment

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

good catch, i'll disable in both sides for now and re-enable when i fix

@wmak wmak requested a review from a team as a code owner January 23, 2025 19:37
@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Jan 23, 2025
Copy link
Contributor

🚨 Warning: This pull request contains Frontend and Backend changes!

It's discouraged to make changes to Sentry's Frontend and Backend in a single pull request. The Frontend and Backend are not atomically deployed. If the changes are interdependent of each other, they must be separated into two pull requests and be made forward or backwards compatible, such that the Backend or Frontend can be safely deployed independently.

Have questions? Please ask in the #discuss-dev-infra channel.

wmak added 7 commits January 23, 2025 14:47
- VirtualColumnContexts aren't available on timeseries, so if we filter
  by a vcc field (project, device.class) we need custom logic
- From a discussion in slack going to drop device.module support, will
  do that in a follow up PR
- TODO: move all of this into VCC definition so that we can be dataset
  agnostic within the SearchResolver
@wmak wmak merged commit 3e48f97 into master Jan 23, 2025
49 checks passed
@wmak wmak deleted the wmak/feat/filter-without-vcc branch January 23, 2025 21:05
andrewshie-sentry pushed a commit that referenced this pull request Jan 29, 2025
…83663)

- VirtualColumnContexts aren't available on timeseries, so if we filter
by a vcc field (project, device.class) we need custom logic
- From a discussion in slack going to drop device.module support, will
do that in a follow up PR
@github-actions github-actions bot locked and limited conversation to collaborators Feb 8, 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 Scope: Frontend Automatically applied to PRs that change frontend components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants