Skip to content

Commit a41492a

Browse files
committed
fix(trace): Return no results when visible type IDs list is empty
When organization is provided but get_visible(organization) returns an empty list, the code now returns no results by filtering with an impossible occurrence_type_id (-1), instead of falling back to an unfiltered query that would return all occurrences. This matches the behavior in src/sentry/issues/search.py which returns None when no group types are visible.
1 parent 61e5100 commit a41492a

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/sentry/snuba/trace.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,9 @@ def _perf_issues_query(
334334

335335
if organization:
336336
visible_type_ids = [gt.type_id for gt in grouptype_registry.get_visible(organization)]
337-
if visible_type_ids:
337+
if not visible_type_ids:
338+
query = f"trace:{trace_id} occurrence_type_id:[-1]"
339+
else:
338340
query = f"trace:{trace_id} occurrence_type_id:[{','.join(map(str, visible_type_ids))}]"
339341

340342
occurrence_query = DiscoverQueryBuilder(

0 commit comments

Comments
 (0)