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

fix(performance): txn summary "has" queries should fall back #73767

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 3 additions & 10 deletions src/sentry/search/events/builder/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -709,17 +709,10 @@ def default_filter_converter(self, search_filter: SearchFilter) -> WhereType | N

# Handle checks for existence
if search_filter.operator in ("=", "!=") and search_filter.value.value == "":
if name in constants.METRICS_MAP:
if search_filter.operator == "!=":
return None
else:
raise IncompatibleMetricsQuery("!has isn't compatible with metrics queries")
if name in constants.METRICS_MAP and search_filter.operator == "!=":
return None
else:
return Condition(
Function("has", [Column("tags.key"), self.resolve_metric_index(name)]),
Op.EQ if search_filter.operator == "!=" else Op.NEQ,
1,
)
raise IncompatibleMetricsQuery("has isn't compatible with metrics queries")

if name in ["organization_id", "org_id"]:
raise IncompatibleMetricsQuery(f"{name} isn't compatible with metrics queries")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,8 @@ def get_mep(query):
assert get_mep(
"event.type:transaction OR transaction:foo_transaction"
), "boolean with mep filter"
assert get_mep("has:transaction.duration"), "has a tag in the metrics dataset"
assert not get_mep("has:device"), "has a tag not in the metrics dataset"

def test_having_condition_with_preventing_aggregates(self):
response = self.do_request(
Expand Down
Loading