Skip to content

Commit 29094f6

Browse files
Abdullah KhanAbdullah Khan
authored andcommitted
feat(source-map-issues): Supporting count_unique aggregation on eap processing errors
1 parent 28a2364 commit 29094f6

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

src/sentry/search/eap/processing_errors/aggregates.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
AttributeArgumentDefinition,
1010
count_argument_resolver_optimized,
1111
)
12+
from sentry.search.eap.common_aggregates import count_unique_aggregate_definition
1213

1314
PROCESSING_ERRORS_ALWAYS_PRESENT_ATTRIBUTES = [
1415
AttributeKey(name="error_type", type=AttributeKey.Type.TYPE_STRING),
@@ -34,4 +35,5 @@
3435
PROCESSING_ERRORS_ALWAYS_PRESENT_ATTRIBUTES
3536
),
3637
),
38+
"count_unique": count_unique_aggregate_definition(default_arg="event_id"),
3739
}

tests/sentry/search/eap/test_processing_errors.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
from unittest import TestCase
22

33
from sentry_protos.snuba.v1.trace_item_attribute_pb2 import (
4+
AttributeAggregation,
45
AttributeKey,
56
AttributeValue,
7+
ExtrapolationMode,
8+
Function,
69
StrArray,
710
)
811
from sentry_protos.snuba.v1.trace_item_filter_pb2 import (
@@ -137,3 +140,13 @@ def test_none_query(self) -> None:
137140
where, having, _ = self.resolver.resolve_query(None)
138141
assert where is None
139142
assert having is None
143+
144+
def test_count_unique(self) -> None:
145+
resolved_column, virtual_context = self.resolver.resolve_column("count_unique(event_id)")
146+
assert resolved_column.proto_definition == AttributeAggregation(
147+
aggregate=Function.FUNCTION_UNIQ,
148+
key=AttributeKey(name="event_id", type=AttributeKey.Type.TYPE_STRING),
149+
label="count_unique(event_id)",
150+
extrapolation_mode=ExtrapolationMode.EXTRAPOLATION_MODE_SAMPLE_WEIGHTED,
151+
)
152+
assert virtual_context is None

0 commit comments

Comments
 (0)