Skip to content

Commit

Permalink
Use _select_supported_filters everywhere appropriate
Browse files Browse the repository at this point in the history
  • Loading branch information
phacops committed Jan 2, 2025
1 parent 868c71a commit 293f71a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions snuba/web/rpc/v1/endpoint_get_traces.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ def _validate_order_by(in_msg: GetTracesRequest) -> None:
)


# TODO: support more than one filter.
def _select_supported_filters(
filters: RepeatedCompositeFieldContainer[GetTracesRequest.TraceFilter],
) -> TraceItemFilter:
Expand All @@ -241,6 +242,7 @@ def _select_supported_filters(
if filter_count > 1:
raise BadSnubaRPCRequestException("Multiple filters are not supported.")
try:
# Find first span filter.
return next(
f.filter
for f in filters
Expand Down Expand Up @@ -293,8 +295,6 @@ def _list_trace_ids(
self,
request: GetTracesRequest,
) -> dict[str, int]:
# Find first span filter.
# TODO: support more than one filter.
trace_item_filters_expression = trace_item_filters_to_expression(
_select_supported_filters(request.filters),
)
Expand Down Expand Up @@ -356,7 +356,7 @@ def _get_metadata_for_traces(
trace_ids: dict[str, int],
) -> list[GetTracesResponse.Trace]:
trace_item_filters_expression = trace_item_filters_to_expression(
request.filters[0].filter if len(request.filters) > 0 else TraceItemFilter()
_select_supported_filters(request.filters),
)

selected_columns: list[SelectedExpression] = []
Expand Down

0 comments on commit 293f71a

Please sign in to comment.