Skip to content
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

Merged
merged 1 commit into from Apr 14, 2020

Conversation

sahil143
Copy link
Contributor

@sahil143 sahil143 commented Mar 27, 2020

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:

Peek 2020-03-28 03-22
UPDATED SCREENSHOT
Screenshot from 2020-04-01 03-08-40

Unit test coverage report:
Screenshot from 2020-04-01 01-11-41
Screenshot from 2020-04-01 01-13-07

Test setup:

Browser conformance:

  • Chrome
  • Firefox
  • Safari
  • Edge

@openshift-ci-robot openshift-ci-robot added component/core Related to console core functionality component/dev-console Related to dev-console component/shared Related to console-shared labels Mar 27, 2020
Copy link
Contributor

@andrewballantyne andrewballantyne left a 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/console-shared/src/hooks/screenfull.ts Outdated Show resolved Hide resolved
@@ -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 = {}) => {
Copy link
Contributor

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).

Copy link
Contributor

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.

cc @christianvogt

@sahil143 sahil143 force-pushed the multi-stream-c branch 2 times, most recently from 8e623fb to 5164ad5 Compare March 31, 2020 09:00
React.useEffect(() => {
if (!scrollPane.current) return;
const height = Math.floor(
window.innerHeight - scrollPane.current.getBoundingClientRect().top - (isFullScreen ? 0 : 50),
Copy link
Contributor

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);
Copy link
Contributor

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.

@andrewballantyne
Copy link
Contributor

/kind feature

@openshift-ci-robot openshift-ci-robot added the kind/feature Categorizes issue or PR as related to a new feature. label Mar 31, 2020
@sahil143 sahil143 force-pushed the multi-stream-c branch 2 times, most recently from 50fe5c4 to 5ee3d02 Compare April 1, 2020 16:42
Copy link
Contributor

@andrewballantyne andrewballantyne left a 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).

Copy link
Contributor

@andrewballantyne andrewballantyne left a 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

Copy link
Contributor

@andrewballantyne andrewballantyne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Apr 1, 2020
@christianvogt
Copy link
Contributor

I'm still seeing logs stream in the wrong order for a completed task with several steps:

Here's a screenshot where you can see the 2nd step has displayed before the first.
image

@sahil143 sahil143 force-pushed the multi-stream-c branch 4 times, most recently from 45744f7 to 60c86b6 Compare April 9, 2020 18:36
@sahil143
Copy link
Contributor Author

sahil143 commented Apr 9, 2020

I'm still seeing logs stream in the wrong order for a completed task with several steps:
Here's a screenshot where you can see the 2nd step has displayed before the first.

@christianvogt fixed. Please review it again.

.onclose(() => {
onCompleteRef.current(name);
})
.onerror(() => {
Copy link
Contributor

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).

image

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>}
          />

Copy link
Contributor Author

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

Otherwise I'm getting proper logs
Screenshot from 2020-04-10 00-44-32

Copy link
Contributor

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.

Copy link
Contributor Author

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;
Copy link
Contributor

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

Suggested change
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'),
Copy link
Contributor

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">
Copy link
Contributor

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">
Copy link
Contributor

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.

Suggested change
<span className="odc-multi-stream-logs__taskName--loading">
<span className="odc-multi-stream-logs__loadingIndicator">

(for instance)

@@ -0,0 +1,612 @@

Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor

@andrewballantyne andrewballantyne left a 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.

@andrewballantyne
Copy link
Contributor

@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)

@sahil143
Copy link
Contributor Author

sahil143 commented Apr 9, 2020

@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

@openshift-cherrypick-robot

@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:

/cherry-pick release-4.4

Need to aim to get this into 4.4 before GA as not to have a broken 4.4 feature the release it was added 😄

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.

@andrewballantyne
Copy link
Contributor

Ah shoot! Wrong PR! haha...

/cherry-pick cancel

@openshift-cherrypick-robot

@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:

Ah shoot! Wrong PR! haha...

/cherry-pick cancel

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.

@openshift-ci-robot openshift-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 10, 2020
@sahil143 sahil143 force-pushed the multi-stream-c branch 2 times, most recently from c1a1011 to eb7fcdd Compare April 12, 2020 20:01
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
@openshift-ci-robot openshift-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 12, 2020
Copy link
Contributor

@andrewballantyne andrewballantyne left a 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.

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Apr 13, 2020
@christianvogt
Copy link
Contributor

/approve

@openshift-ci-robot
Copy link
Contributor

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 14, 2020
@openshift-merge-robot openshift-merge-robot merged commit ded0639 into openshift:master Apr 14, 2020
@openshift-cherrypick-robot

@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:

Ah shoot! Wrong PR! haha...

/cherry-pick cancel

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.

@spadgett spadgett added this to the v4.5 milestone Apr 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. component/core Related to console core functionality component/dev-console Related to dev-console component/shared Related to console-shared kind/feature Categorizes issue or PR as related to a new feature. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants