Skip to content

[UI] Query logs using descending#2915

Merged
peterschmidt85 merged 12 commits intomasterfrom
2892_logs
Jul 21, 2025
Merged

[UI] Query logs using descending#2915
peterschmidt85 merged 12 commits intomasterfrom
2892_logs

Conversation

@peterschmidt85
Copy link
Copy Markdown
Contributor

@peterschmidt85 peterschmidt85 commented Jul 18, 2025

Fixes #2892

This includes:

  • Allowing descending in pull log requests
  • Supporting descending in FileLogStorage (this implements reading of lines from a file in a reversed order)
  • Changing the pull log limit from 1000 to 100 (since now our chunks are larger than they are used to be)
  • Re-implemented to make FileLogStorage._read_lines_reversed fast regardless of start_offset

Plus, in addition to #2892, this PR updates CloudWatchLogStorage to implement retrying when it fetches empty log pages. The maximum number of retries is set to 10. In case ascending is used, after hitting the limit CloudWatchLogStorage sets next_token to None (meaning no more logs). This is not ideal but given that ascending mode is not going to be used anymore, we can live with that for now. If descending is used, CloudWatchLogStorage returns next_token properly. (allowing the UI or CLI implement the logic of trying again).

Out of the scope:

  • Updating dstack log to use descending and support --start

olgenn and others added 2 commits July 18, 2025 00:04
- [x] Allowed `descending` in `PollLogsRequest`
- [x] Supported `descending` in `FileLogStorage` (implemented an algorithm that reads lines from the end of t he file)
- [x] Updated `CloudWatchLogStorage` to support `MAX_RETRIES` (to skip empty pages)
@peterschmidt85
Copy link
Copy Markdown
Contributor Author

Pending changes from @olgenn:

  1. Fix the height of the Logs UI component.
  2. Fix the background color of the Logs UI component.
  3. Add Legacy mode toggler (off by default) that checks if log messages are base64-encoded strings and in this case decodes them.

@olgenn olgenn marked this pull request as ready for review July 18, 2025 18:41
@r4victor
Copy link
Copy Markdown
Collaborator

This is not ideal but given that ascending mode is not going to be used anymore, we can live with that for now.

You mean not used by the UI? Still used by the CLI and the API default t.

@peterschmidt85 peterschmidt85 requested a review from r4victor July 21, 2025 10:59
Re-implemented to make `_read_lines_reversed` fast regardless of `start_offset`
@peterschmidt85 peterschmidt85 merged commit cc77d48 into master Jul 21, 2025
26 checks passed
@peterschmidt85 peterschmidt85 deleted the 2892_logs branch July 21, 2025 11:11
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.

[UI] Query logs using descending

3 participants