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

Renderer file logging transport #6795

Merged
merged 8 commits into from Feb 8, 2023
Merged

Conversation

samitiilikainen
Copy link
Contributor

@samitiilikainen samitiilikainen commented Dec 20, 2022

Add file logging to renderer, writing separate log files for renderer main frame and each cluster frame.

Closes file handles (otherwise left open by Winston) on main and cluster frame refresh and when cluster frame is closed through cluster disconnect.

Related to lensapp/support-lens-extension#118

@samitiilikainen samitiilikainen requested review from Nokel81 and a team December 20, 2022 12:39
@samitiilikainen samitiilikainen requested a review from a team as a code owner December 20, 2022 12:39
@samitiilikainen samitiilikainen requested review from jim-docker and removed request for a team December 20, 2022 12:39
samitiilikainen added a commit that referenced this pull request Dec 20, 2022
Move navigation logging to `setupLoggingForNavigationInjectable` to prevent cycle of injectables from occurring. Wasn't eventually needed for #6795 but still an improvement.

Credit for the implementation goes to @Nokel81 , thanks!
@Nokel81 Nokel81 added the enhancement New feature or request label Dec 20, 2022
@Nokel81 Nokel81 added this to the 6.4.0 milestone Dec 20, 2022
Nokel81
Nokel81 previously approved these changes Dec 20, 2022
@Nokel81
Copy link
Collaborator

Nokel81 commented Dec 20, 2022

@samitiilikainen Please sign your commit

samitiilikainen added a commit that referenced this pull request Dec 20, 2022
Move navigation logging to `setupLoggingForNavigationInjectable` to prevent cycle of injectables from occurring. Wasn't eventually needed for #6795 but still an improvement.

Credit for the implementation goes to @Nokel81 , thanks!

Signed-off-by: Sami Tiilikainen <97873007+samitiilikainen@users.noreply.github.com>
Nokel81 pushed a commit that referenced this pull request Dec 20, 2022
Move navigation logging to `setupLoggingForNavigationInjectable` to prevent cycle of injectables from occurring. Wasn't eventually needed for #6795 but still an improvement.

Credit for the implementation goes to @Nokel81 , thanks!

Signed-off-by: Sami Tiilikainen <97873007+samitiilikainen@users.noreply.github.com>

Signed-off-by: Sami Tiilikainen <97873007+samitiilikainen@users.noreply.github.com>
@samitiilikainen samitiilikainen marked this pull request as draft December 20, 2022 14:02
@Nokel81 Nokel81 modified the milestones: 6.3.0, 6.4.0 Dec 21, 2022
@github-actions
Copy link
Contributor

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@github-actions
Copy link
Contributor

Conflicts have been resolved. A maintainer will review the pull request shortly.

@samitiilikainen samitiilikainen marked this pull request as ready for review December 23, 2022 12:02
@github-actions
Copy link
Contributor

github-actions bot commented Jan 9, 2023

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@github-actions
Copy link
Contributor

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@github-actions
Copy link
Contributor

Conflicts have been resolved. A maintainer will review the pull request shortly.

Copy link
Contributor

@jim-docker jim-docker left a comment

Choose a reason for hiding this comment

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

I noticed we have many console.warn etc calls still in the core code. They show up in the dev tools console but not in the log file of course. Out of scope for this PR, just noting it.

import currentlyInClusterFrameInjectable from "../routes/currently-in-cluster-frame.injectable";
import { getClusterIdFromHost } from "../utils";

const rendererFileLoggerTransportInjectable = getInjectable({
Copy link
Contributor

Choose a reason for hiding this comment

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

usually the filename matches the injectable name/id ?

});

window.addEventListener("beforeunload", onCloseFrame, { capture: true });
window.addEventListener("pagehide", onCloseFrame, { capture: true });
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this mean logging to file stops if the cluster frame is not in view? If I disconnect a cluster while on the catalog cluster list, any disconnect logging is missed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not all logging. It stops cluster frame logging right before the iframe is removed from DOM (when also all code execution in that iframe should stop). Stopping logging of the cluster frame does not affect logging done by the renderer main frame (catalog page).

Comment on lines 36 to 38
maxsize: 1024 * 1024,
maxFiles: 0,
tailable: true,
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure what the expectation is here, but I tested with a file that was just under 1M in size and observed that when the file reached 1M nothing more was written to the file or any other file, and nothing more was written to the developer tools console either??

rendererlogging.mov

This is on Ubuntu 22.04. I artificially padded the file with logs to get it near 1M in size.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks! Expectation was that it would keep writing logs and older lines would be lost but I was mistaken. I'll increase the maxFiles to allow it to properly rotate files.

Add file logging to renderer, writing separate log files for renderer main frame and each cluster frame.

Related to lensapp/support-lens-extension#118

Signed-off-by: Sami Tiilikainen <97873007+samitiilikainen@users.noreply.github.com>
There is too much noise on debug level from api responses etc

Signed-off-by: Sami Tiilikainen <97873007+samitiilikainen@users.noreply.github.com>
It seems cluster onbeforeunload is not triggered when iframe is removed from dom by the parent (when disconnecting a cluster).

While on root/main frame the beforeunload event does work, it seems to be adviced to use pagehide instead.

Signed-off-by: Sami Tiilikainen <97873007+samitiilikainen@users.noreply.github.com>
Signed-off-by: Sami Tiilikainen <97873007+samitiilikainen@users.noreply.github.com>
This should cover reloading main and cluster frames and closing cluster frame throught disconnecting cluster. No file handles should be left open now.

Signed-off-by: Sami Tiilikainen <97873007+samitiilikainen@users.noreply.github.com>
Signed-off-by: Sami Tiilikainen <97873007+samitiilikainen@users.noreply.github.com>
Signed-off-by: Sami Tiilikainen <97873007+samitiilikainen@users.noreply.github.com>
jim-docker
jim-docker previously approved these changes Jan 30, 2023
Copy link
Contributor

@jim-docker jim-docker left a comment

Choose a reason for hiding this comment

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

Thanks for doing this!

(users with many many clusters may notice large disk usage by Lens due to all the new log files)

Does not seem to be needed for log files to be successfully closed and caused integration tests to fail.

Signed-off-by: Sami Tiilikainen <97873007+samitiilikainen@users.noreply.github.com>
Copy link
Collaborator

@Nokel81 Nokel81 left a comment

Choose a reason for hiding this comment

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

Finally looks like this is green!

@Nokel81 Nokel81 merged commit ac2d0e4 into master Feb 8, 2023
@Nokel81 Nokel81 deleted the feature/renderer-file-logging-2 branch February 8, 2023 10:50
@Nokel81 Nokel81 mentioned this pull request Feb 22, 2023
samitiilikainen added a commit that referenced this pull request Feb 28, 2023
Renderer file logging still caused UI freezing (at least on apple silicon macs) when cluster frame was open and main frame was reloaded.

See #544

This reverts commit ac2d0e4.
samitiilikainen added a commit that referenced this pull request Feb 28, 2023
Renderer file logging still caused UI freezing (at least on apple silicon macs) when cluster frame was open and main frame was reloaded.

See #544

This reverts commit ac2d0e4.

Signed-off-by: Sami Tiilikainen <97873007+samitiilikainen@users.noreply.github.com>
Nokel81 pushed a commit that referenced this pull request Feb 28, 2023
Renderer file logging still caused UI freezing (at least on apple silicon macs) when cluster frame was open and main frame was reloaded.

See #544

This reverts commit ac2d0e4.

Signed-off-by: Sami Tiilikainen <97873007+samitiilikainen@users.noreply.github.com>
Nokel81 pushed a commit that referenced this pull request Mar 1, 2023
Renderer file logging still caused UI freezing (at least on apple silicon macs) when cluster frame was open and main frame was reloaded.

See #544

This reverts commit ac2d0e4.

Signed-off-by: Sami Tiilikainen <97873007+samitiilikainen@users.noreply.github.com>
@Nokel81 Nokel81 mentioned this pull request Mar 1, 2023
Nokel81 added a commit that referenced this pull request Mar 1, 2023
* General fixes for release-tool (#7238)

* General fixes for release-tool

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Revert change to number of PRs retrieved

Signed-off-by: Sebastian Malton <sebastian@malton.name>

---------

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Throw on errors in kubectlApplyFolder (#7239)

Signed-off-by: Panu Horsmalahti <phorsmalahti@mirantis.com>

* Quick fix for store migration version being wrong (#7243)

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Revert "Renderer file logging transport (#6795)" (#7245)

Renderer file logging still caused UI freezing (at least on apple silicon macs) when cluster frame was open and main frame was reloaded.

See #544

This reverts commit ac2d0e4.

Signed-off-by: Sami Tiilikainen <97873007+samitiilikainen@users.noreply.github.com>

* Fix extension install (#7247)

* Fix extension install

- Remove old bundled extension dependencies
- Make sure external extensions are installed as optional

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Ignore ENOENT errors

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Add comment

Signed-off-by: Sebastian Malton <sebastian@malton.name>

---------

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Release 6.4.0

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Fix lint

Signed-off-by: Sebastian Malton <sebastian@malton.name>

---------

Signed-off-by: Sebastian Malton <sebastian@malton.name>
Signed-off-by: Panu Horsmalahti <phorsmalahti@mirantis.com>
Signed-off-by: Sami Tiilikainen <97873007+samitiilikainen@users.noreply.github.com>
Co-authored-by: Panu Horsmalahti <phorsmalahti@mirantis.com>
Co-authored-by: Sami Tiilikainen <97873007+samitiilikainen@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants