Skip to content

Commit

Permalink
im a cat im a cat im a cat im a cat
Browse files Browse the repository at this point in the history
  • Loading branch information
kylemumma committed Jan 2, 2025
1 parent f03ae4d commit 5eba37b
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion snuba/web/rpc/v1/endpoint_trace_item_attribute_names.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ def _build_response(
attributes = convert_to_attributes(res, req.type)
page_token = (
PageToken(offset=req.page_token.offset + len(attributes))
if req.page_token.HasField("offset")
if req.page_token.HasField("offset") or len(attributes) == 0
else PageToken(
filter_offset=TraceItemFilter(
comparison_filter=ComparisonFilter(
Expand Down
20 changes: 20 additions & 0 deletions tests/web/rpc/v1/test_endpoint_trace_item_attribute_names.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,26 @@ def test_with_page_token_offset(self) -> None:
done += at_a_time
assert expected_attributes == []

def test_empty_results(self) -> None:
req = TraceItemAttributeNamesRequest(
meta=RequestMeta(
project_ids=[1, 2, 3],
organization_id=1,
cogs_category="something",
referrer="something",
start_timestamp=Timestamp(
seconds=int((BASE_TIME - timedelta(days=1)).timestamp())
),
end_timestamp=Timestamp(
seconds=int((BASE_TIME + timedelta(days=1)).timestamp())
),
),
type=AttributeKey.Type.TYPE_STRING,
value_substring_match="this_definitely_doesnt_exist_93710",
)
res = EndpointTraceItemAttributeNames().execute(req)
assert res.attributes == []

def test_page_token_offset_filter(self) -> None:

expected_attributes = []
Expand Down

0 comments on commit 5eba37b

Please sign in to comment.