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
Multi-Stream log component #4845
Multi-Stream log component #4845
Conversation
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.
@sahil143 Definitely a few more things needed.
I'll test around and see if I see anything else -- this was mainly the review of the code.
/assign
frontend/packages/dev-console/src/components/pipelineruns/logs/Logs.scss
Outdated
Show resolved
Hide resolved
frontend/packages/dev-console/src/components/pipelineruns/detail-page-tabs/PipelineRunLogs.scss
Outdated
Show resolved
Hide resolved
frontend/packages/dev-console/src/components/pipelineruns/logs/Logs.tsx
Outdated
Show resolved
Hide resolved
frontend/packages/dev-console/src/components/pipelineruns/logs/Logs.tsx
Outdated
Show resolved
Hide resolved
frontend/packages/dev-console/src/components/pipelineruns/logs/MultiStreamLogs.scss
Outdated
Show resolved
Hide resolved
frontend/packages/dev-console/src/utils/__tests__/pipeline-utils.spec.ts
Outdated
Show resolved
Hide resolved
d40e2c0
to
eb981b4
Compare
frontend/packages/dev-console/src/components/pipelineruns/logs/Logs.scss
Outdated
Show resolved
Hide resolved
frontend/packages/dev-console/src/components/pipelineruns/logs/Logs.tsx
Outdated
Show resolved
Hide resolved
frontend/packages/dev-console/src/components/pipelineruns/logs/MultiStreamLogs.tsx
Outdated
Show resolved
Hide resolved
frontend/packages/dev-console/src/components/pipelineruns/logs/MultiStreamLogs.tsx
Show resolved
Hide resolved
frontend/packages/dev-console/src/components/pipelineruns/logs/logs-utils.ts
Outdated
Show resolved
Hide resolved
frontend/public/co-fetch.js
Outdated
@@ -124,8 +124,8 @@ export const coFetchUtils = { | |||
parseJson, | |||
}; | |||
|
|||
export const coFetchJSON = (url, method = 'GET', options = {}) => { | |||
const headers = { Accept: 'application/json' }; | |||
export const coFetchCommon = (url, method = 'GET', options = {}, customHeaders = {}) => { |
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.
FYI @benjaminapetersen @spadgett
You guys cool with this change? I think it's helpful just to merge the fetch logic together and allow for a returning of plain text for the log component to make use of a static download (vs from a websocket).
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.
@sahil143 Perhaps reach out to them on Slack and link them to this change in your PR (or this comment). We should get buy-in from the Admin team.
...end/packages/dev-console/src/components/pipelineruns/logs/__tests__/MultiStreamLogs.spec.tsx
Show resolved
Hide resolved
...end/packages/dev-console/src/components/pipelineruns/logs/__tests__/MultiStreamLogs.spec.tsx
Outdated
Show resolved
Hide resolved
...end/packages/dev-console/src/components/pipelineruns/logs/__tests__/MultiStreamLogs.spec.tsx
Show resolved
Hide resolved
8e623fb
to
5164ad5
Compare
frontend/packages/dev-console/src/components/pipelineruns/logs/Logs.tsx
Outdated
Show resolved
Hide resolved
React.useEffect(() => { | ||
if (!scrollPane.current) return; | ||
const height = Math.floor( | ||
window.innerHeight - scrollPane.current.getBoundingClientRect().top - (isFullScreen ? 0 : 50), |
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, can we put this as padding on the top div under the classname of just odc-multi-stream-logs
? I think this is a better way to go about it than a random 50
here.
if (!scrollPane.current) return; | ||
let logString = scrollPane.current.innerText; | ||
// Removing 'Taskname' from file content and using it in 'filename' to keep it similar with resource-log | ||
logString = logString.substring(logString.indexOf('\n') + 1); |
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.
If you do not have a solution for the auto scroll problem, we can address it in another PR... let's not hold this one up indefinitely as we figure out that issue.
/kind feature |
5164ad5
to
5c731ca
Compare
frontend/packages/dev-console/src/components/pipelineruns/logs/Logs.tsx
Outdated
Show resolved
Hide resolved
50fe5c4
to
5ee3d02
Compare
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.
Soooooo close, just saw an error as I was about to lgtm this.
Error was an object and React crashed. Came through the websocket on the first task of a nodejs Pipeline (from the add flow).
frontend/packages/dev-console/src/components/pipelineruns/logs/Logs.tsx
Outdated
Show resolved
Hide resolved
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.
Wrong [review] type lol
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.
/lgtm
45744f7
to
60c86b6
Compare
@christianvogt fixed. Please review it again. |
.onclose(() => { | ||
onCompleteRef.current(name); | ||
}) | ||
.onerror(() => { |
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.
Something is fishy here... I tried to find the cause but I'm a bit perplexed. On the first step of each task, it errors out with a 400 (client) error. The websocket logs are entirely unhelpful and the error is the websocket is closed (readyState === 3).
Pods do not have this issue 😕 If I go to the Pod fast enough, I see it log out without an issue and then close the websocket. Not sure what we are doing differently here.
We should definitely track this down, but I think we can leave this for now and swing back in 4.5 bug fixing. This is super odd and we are clearly missing something here. Please log a bug to track this @sahil143
Also... Console does a retry
shindig if they showed an error:
<Alert
isInline
className="co-alert"
variant="danger"
title="An error occurred while retrieving the requested logs."
action={<AlertActionLink onClick={this._restartStream}>Retry</AlertActionLink>}
/>
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.
@andrewballantyne I only got this when Websocket request timed out with an error
WebSocket connection to 'ws://localhost:9000/api/kubernetes/api/v1/namespaces/t0s/pods/nodejs-ex-git-a01t7k-build-7d64p-pod-6t9j2/log?container=step-create-dir-image-p8tlw&follow=true' failed: Error during WebSocket handshake: Unexpected response code: 400
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.
Right, and it happened for me every time (tested it at least half a dozen times in a row) for that first step while it was being fetched by the websocket. If you come to this log/task after that first one is done, I see no error.
Still don't see this on the Pod log, clearly something is different. Since it's not critical and we have some bandwidth next sprint, let's just log something to investigate.
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.
Raised a Jira ticket to track this https://issues.redhat.com/browse/ODC-3540.
if (!_.isEmpty(obj?.data)) { | ||
ref.current = obj.data; | ||
} | ||
return obj ? <MultiStreamLogs taskName={taskName} resource={ref.current} /> : null; |
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.
Not that it matters... but why not
return obj ? <MultiStreamLogs taskName={taskName} resource={ref.current} /> : null; | |
return ref.current ? <MultiStreamLogs taskName={taskName} resource={ref.current} /> : null; |
Odd to put a catch around obj but ignore the catch logic when you go to rendering.
/> | ||
<div | ||
className={classNames('odc-multi-stream-logs__container', { | ||
'is-edge': window.navigator.userAgent.includes('Edge'), |
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.
Remove, not used anymore.
onScroll={handleScrollCallback} | ||
data-test-id="logs-task-container" | ||
> | ||
<div className="odc-multi-stream-logs__container--pos"> |
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.
--
is a modifier... you're not modifying this one, this would just be an element, no?
<div className="odc-multi-stream-logs__taskName"> | ||
{taskName} | ||
{stillFetching && ( | ||
<span className="odc-multi-stream-logs__taskName--loading"> |
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.
Same here, don't think the modifier is needed as this is just a conditional element.
<span className="odc-multi-stream-logs__taskName--loading"> | |
<span className="odc-multi-stream-logs__loadingIndicator"> |
(for instance)
@@ -0,0 +1,612 @@ | |||
|
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.
What is this? Some debugging report?
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.
yes, these are created when webpack build goes out of memory, My bad didn't notice 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.
Oh, meant to add this to my review... I'll have to retest after the latest changes... but Edge expands fine now with the fullscreen changes you did to support modifiers.
@sahil143 can you squash your commits... I only see maybe 2 distinct items in there... The coFetchText one and this component refactor. So please make it into 1/2 commits (whichever you prefer) |
squashed commit into one |
@andrewballantyne: once the present PR merges, I will cherry-pick it on top of release-4.4 in a new PR and assign it to you. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Ah shoot! Wrong PR! haha... /cherry-pick cancel |
@andrewballantyne: once the present PR merges, I will cherry-pick it on top of cancel in a new PR and assign it to you. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
c1a1011
to
eb7fcdd
Compare
commit add http request a make reuested changes add vars fix lint errors add unit tests remove comments remove co-fetch code remove co fetch reference make request changes make requested changes make requested changes changes make requested changes rmeove fragment add tests make changes create coFetchText utility remove Accept Header use flex to determine the height of logs container, fix useScrollDirection and useFullscreen, fixe logs.ts to use ref for callbacks fix unit test change fullscreen hook implementation to use native fullscreen api instead of screenfull package full screenD remove data-id add null check for fullscreen fix overflow for logs make requested changes support older browser using prefixes make requesteddd changes changes small fix fix order for steps fix unit tests make requested changes add z-index make requested changes changes
eb7fcdd
to
ac81f13
Compare
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.
/lgtm
This is definitely in a better place now. Thanks for the changes @sahil143
There are still a few QoL things I think we can chase down to make this experience even better. But let's put that off to another PR and likely after Feature Freeze.
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: andrewballantyne, christianvogt, sahil143 The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
@andrewballantyne: cannot checkout cancel: error checking out cancel: exit status 1. output: error: pathspec 'cancel' did not match any file(s) known to git. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Fixes: https://issues.redhat.com/browse/ODC-2381
https://issues.redhat.com/browse/ODC-2408
Analysis / Root cause:
Create a Multi Stream Log component
Solution Description:
This PR adds a Multi Stream Log component
Screen shots / Gifs for design review:
UPDATED SCREENSHOT
Unit test coverage report:
Test setup:
Browser conformance: