feat(query_client): add pagination support for records queries#1679
Draft
wingding12 wants to merge 3 commits intopydantic:mainfrom
Draft
feat(query_client): add pagination support for records queries#1679wingding12 wants to merge 3 commits intopydantic:mainfrom
wingding12 wants to merge 3 commits intopydantic:mainfrom
Conversation
…tic#1608) Add iter_paginated_records() to both LogfireQueryClient and AsyncLogfireQueryClient to enable downloading more than the 10,000 row API limit. Uses cursor-based pagination with (start_timestamp, trace_id, span_id) or (created_at, trace_id, span_id, kind) when use_created_at=True. Implements pagination guidelines from maintainer discussion in the issue.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
…ponse path - Unit tests for _build_paginated_records_sql (use_created_at, where+cursor, cursor only) - Unit tests for _extract_cursor_from_row (use_created_at, missing keys returns None) - Integration tests for empty response handling in iter_paginated_records - Add VCR cassettes for empty response tests
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1608
Summary
Adds built-in pagination support to the Logfire query client to enable downloading more than the 10,000 row API limit.
Changes
iter_paginated_records()method to bothLogfireQueryClientandAsyncLogfireQueryClient(start_timestamp, trace_id, span_id)by defaultuse_created_at=Truefor paginating over recent data where new rows may be inserted (usescreated_at, trace_id, span_id, kind)PaginationCursorTypedDict andMAX_QUERY_LIMITconstantUsage