Skip to content

Conversation

kylemumma
Copy link
Member

this PR implements support for pagination using limit and offset in the GetTrace endpoint. this will be useful for displaying traces with a lot of trace items.

@kylemumma kylemumma marked this pull request as ready for review October 1, 2025 23:35
@kylemumma kylemumma requested review from a team as code owners October 1, 2025 23:35
Comment on lines +297 to +299
if request.limit == 0:
# theres no limit, so we don't need to return a page token
return None
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we have a built in default limit so this condition is not correct

total_items = 0
else:
total_items = sum(len(group.items) for group in item_groups)
return PageToken(offset=request.page_token.offset + total_items)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is the correct strategy to use. I think what you want is to use a combination of the largest timestamp and the last item id. You would also need to add an item_id to the order_by this way you don't have to rescan the entire trace you've already scanned

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I decided to implement it using limit/offset rather than filter_offset for the first pass since its simpler and I thought performance isn't too much of a concern at this point. Do you disagree?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fair enough

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

although I imagine if it's a really big trace, we may not be able to fit it into memory to sort it, so I would want to follow up right after this

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think performance is in fact a concern because we'd be paginating big traces that can't be loaded right now.

I think we push to implement @volokluev 's suggestion right now.

@kylemumma kylemumma closed this Oct 20, 2025
@kylemumma
Copy link
Member Author

should do w page token

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.

3 participants