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.
fix: let workspace pages download partial logs for unhealthy workspaces #13761
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: let workspace pages download partial logs for unhealthy workspaces #13761
Changes from 10 commits
f1f5f88
edd6362
901aa39
e1d8113
87f57aa
5bf2baf
5c2316b
edd6569
2eb7d6e
fa06515
8fb4496
6935f50
f74eda4
7b76eb7
07ff536
460aa53
5a449b4
eb4f88c
71692b6
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Previously: we were checking that the array existed, but not that it actually had data
Really do think that we need to bite the bullet and get TypeScript's
noUncheckedIndexedAccess
compiler option turned on, because it would've caught thisThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a good one and would require a ticket and PR by itself.
Check failure on line 3 in site/src/pages/WorkspacePage/WorkspaceActions/DownloadLogsDialog.tsx
Check failure on line 3 in site/src/pages/WorkspacePage/WorkspaceActions/DownloadLogsDialog.tsx
Check failure on line 7 in site/src/pages/WorkspacePage/WorkspaceActions/DownloadLogsDialog.tsx
Check failure on line 7 in site/src/pages/WorkspacePage/WorkspaceActions/DownloadLogsDialog.tsx
Check failure on line 20 in site/src/pages/WorkspacePage/WorkspaceActions/DownloadLogsDialog.tsx
Check failure on line 20 in site/src/pages/WorkspacePage/WorkspaceActions/DownloadLogsDialog.tsx
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know, but I feel it is an over-optimization. If it is fast enough and does not impact UI usage, I don't see why we should complicate things.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I was considering that, but didn't really have time to test out how long it would take to keep generating blobs every render
To be clear, we basically have two choices:
The original memoization has worse performance than not having memoization at all, because we're still recalculating the blobs every render, but React has to compare dependencies and decide if it should re-calculate the value
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, it was my fault. I usually use "useMemo" to compute a variable value but it would probably be better to be a function. I would rather remove memorization altogether to make things simple.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need to calculate the query options here and not mount it and pass it in the query? I think it is kinda far from what is used and I took some time to link
logOptionsArray
toagentQueryOptions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, this was an over-optimization on my part. I basically figured that since the query objects shouldn't change unless the agents do, it was safe to throw them all together
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was a problem with the previous logic: because
agents
was getting redefined every render, we were also invalidating theuseMemo
dependency array every renderThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved this out of the
try
block, because it should be the part that shouldn't be able to failCheck failure on line 233 in site/src/pages/WorkspacePage/WorkspaceActions/DownloadLogsDialog.tsx
Check failure on line 233 in site/src/pages/WorkspacePage/WorkspaceActions/DownloadLogsDialog.tsx
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the
BLOB_SIZE_UNITS
is only used here, I would not move it to leave outside of the function where it is used.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't get this 😞
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry – just updated the wording on the comment for more clarity!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've been stuck in the pre-Emotion, Backstage-specific version of MUI for the past few months, so please let me know if anything looks funky