Skip to content

fix(eap): Count takes arg #79066

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

Merged
merged 2 commits into from
Oct 15, 2024
Merged
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
9 changes: 2 additions & 7 deletions src/sentry/search/eap/columns.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,12 +222,7 @@ def context_constructor(params: SnubaParams) -> VirtualColumnContext:
"sum": FunctionDefinition(
internal_function=Function.FUNCTION_SUM,
search_type="duration",
arguments=[
ArgumentDefinition(
argument_type="duration",
default_arg="span.duration",
)
],
arguments=[ArgumentDefinition(argument_type="duration", default_arg="span.duration")],
),
"avg": FunctionDefinition(
internal_function=Function.FUNCTION_AVERAGE,
Expand All @@ -237,7 +232,7 @@ def context_constructor(params: SnubaParams) -> VirtualColumnContext:
"count": FunctionDefinition(
internal_function=Function.FUNCTION_COUNT,
search_type="number",
arguments=[ArgumentDefinition(ignored=True)],
arguments=[ArgumentDefinition(argument_type="duration", default_arg="span.duration")],
),
"p50": FunctionDefinition(
internal_function=Function.FUNCTION_P50,
Expand Down
8 changes: 6 additions & 2 deletions tests/sentry/search/eap/test_spans.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,12 +318,16 @@ def test_function_alias(self):
def test_count(self):
resolved_column, virtual_context = self.resolver.resolve_column("count()")
assert resolved_column.proto_definition == AttributeAggregation(
aggregate=Function.FUNCTION_COUNT, key=None, label="count()"
aggregate=Function.FUNCTION_COUNT,
key=AttributeKey(name="duration_ms", type=AttributeKey.Type.TYPE_INT),
label="count()",
)
assert virtual_context is None
resolved_column, virtual_context = self.resolver.resolve_column("count(span.duration)")
assert resolved_column.proto_definition == AttributeAggregation(
aggregate=Function.FUNCTION_COUNT, key=None, label="count(span.duration)"
aggregate=Function.FUNCTION_COUNT,
key=AttributeKey(name="duration_ms", type=AttributeKey.Type.TYPE_INT),
label="count(span.duration)",
)
assert virtual_context is None

Expand Down
Loading