Skip to content

fix(cli): infer logs page size from API response (#8002)#21711

Open
alighazi288 wants to merge 1 commit intoPrefectHQ:mainfrom
alighazi288:fix/issue-8002-logs-pagination
Open

fix(cli): infer logs page size from API response (#8002)#21711
alighazi288 wants to merge 1 commit intoPrefectHQ:mainfrom
alighazi288:fix/issue-8002-logs-pagination

Conversation

@alighazi288
Copy link
Copy Markdown

This PR implements the dynamic logs pagination logic requested in #8002

  • Removes hard-coded LOGS_DEFAULT_PAGE_SIZE = 200 in flow-run logs CLI
  • Dynamically discovers page size by passing limit=None on the first request
  • Refactors --tail logic to buffer pages in TIMESTAMP_DESC order to avoid offset math errors
  • Adds test to verify pagination respects custom PREFECT_SERVER_API_DEFAULT_LIMIT

Checklist

  • This pull request closes Infer page size in prefect flow-run logs CLI #8002
  • If this pull request adds new functionality, it includes unit tests that cover the changes
  • If this pull request removes docs files, it includes redirect settings in mint.json.
  • If this pull request adds functions or classes, it includes helpful docstrings.

@github-actions github-actions Bot added cli Related to the Prefect CLI enhancement An improvement of an existing feature labels Apr 26, 2026
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Apr 26, 2026

Merging this PR will not alter performance

✅ 2 untouched benchmarks


Comparing alighazi288:fix/issue-8002-logs-pagination (275ca0a) with main (efb35bf)

Open in CodSpeed

- Removes hard-coded `LOGS_DEFAULT_PAGE_SIZE = 200` in flow-run logs CLI
- Dynamically discovers page size by passing `limit=None` on the first request
- Refactors `--tail` logic to buffer pages in `TIMESTAMP_DESC` order to avoid offset math errors
- Adds test to verify pagination respects custom `PREFECT_SERVER_API_DEFAULT_LIMIT`

Signed-off-by: alighazi288 <51366992+alighazi288@users.noreply.github.com>
@alighazi288 alighazi288 force-pushed the fix/issue-8002-logs-pagination branch from 36ebf00 to 275ca0a Compare April 26, 2026 22:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli Related to the Prefect CLI enhancement An improvement of an existing feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Infer page size in prefect flow-run logs CLI

1 participant