Skip to content

Commit 91c2df8

Browse files
cursoragentarmenzg
andcommitted
fix: Use OCCURRENCE_STATS_EXCLUDED_ATTRIBUTES_PUBLIC_ALIAS in run_stats_query
The OCCURRENCE_STATS_EXCLUDED_ATTRIBUTES_PUBLIC_ALIAS constant was defined but never used, causing system-level identifiers (id, trace, group_id, etc.) to be included in occurrence stats query results. This adds filtering logic to skip these excluded attributes after translating internal names to public aliases, matching the pattern used for spans stats. Co-authored-by: Armen Zambrano G. <armenzg@users.noreply.github.com>
1 parent d133699 commit 91c2df8

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/sentry/snuba/occurrences_rpc.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,9 @@ def run_stats_query(
315315
response = snuba_rpc.trace_item_stats_rpc(stats_request)
316316
stats = []
317317

318+
from sentry.search.eap.occurrences.attributes import (
319+
OCCURRENCE_STATS_EXCLUDED_ATTRIBUTES_PUBLIC_ALIAS,
320+
)
318321
from sentry.search.eap.utils import can_expose_attribute, translate_internal_to_public_alias
319322

320323
for result in response.results:
@@ -340,6 +343,8 @@ def run_stats_query(
340343
SupportedTraceItemType.OCCURRENCES,
341344
)
342345
public_alias = public_alias or attribute.attribute_name
346+
if public_alias in OCCURRENCE_STATS_EXCLUDED_ATTRIBUTES_PUBLIC_ALIAS:
347+
continue
343348
attrs[public_alias].append(
344349
{"label": bucket.label, "value": bucket.value}
345350
)

0 commit comments

Comments
 (0)