Skip to content

Conversation

jasonyuezhang
Copy link
Owner

This allows count_unique to take numeric attributes as an argument.

Backend for LOGS-398\n\n---\nCopied from getsentry#100889\nOriginal PR: getsentry#100889

Copy link

Enable Numeric Attribute Support in count_unique Aggregation for EAP

This PR expands the count_unique aggregation function within the Early Adopter Program (EAP) search/spans aggregation logic to permit numeric attribute types, rather than previously accepting only string attributes. The code modifies the AggregateDefinition for count_unique to include additional supported types (such as number, integer, duration, percentage, currency, and relevant constants), aligning its accepted argument types with that of other aggregation functions. Associated test coverage is updated to assert that numeric tags can be used with count_unique correctly.

Key Changes

• Updated arguments in the AggregateDefinition for count_unique in src/sentry/search/eap/spans/aggregates.py to include number, integer, duration, percentage, currency, and type constants from constants.SIZE_TYPE and constants.DURATION_TYPE.
• Added/modified test cases in tests/snuba/api/endpoints/test_organization_events_span_indexed.py to validate that count_unique(tags[foo,number]) is accepted and produces correct results.

Affected Areas

src/sentry/search/eap/spans/aggregates.py
tests/snuba/api/endpoints/test_organization_events_span_indexed.py

This summary was automatically generated by @propel-code-bot

@jasonyuezhang jasonyuezhang force-pushed the txiao/feat/support-numeric-values-in-eap-count-unique branch from c086aa4 to e82a896 Compare October 3, 2025 23:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant