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

ComponentInstallers should run after LogManager if a custom one is detected #2592

Merged
merged 2 commits into from
Mar 18, 2021

Conversation

mateuszrzeszutek
Copy link
Member

Fixes #2591

Copy link
Member

@trask trask left a comment

Choose a reason for hiding this comment

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

I wonder if we can keep the Java 8 condition. IIRC (and I likely do not), starting in Java 9, Java classes themselves no longer use j.u.l., instead using a new internal logging API.

// classpath.
// Our solution is to delay the initialization of ComponentInstallers when we detect a custom
// log manager being used.
// Once we see the LogManager class loading, it's safe to run ComponentInstaller#after() because
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// Once we see the LogManager class loading, it's safe to run ComponentInstaller#after() because
// Once we see the LogManager class loading, it's safe to run ComponentInstaller#afterByteBuddyAgent() because

@iNikem
Copy link
Contributor

iNikem commented Mar 18, 2021

@trask @mateuszrzeszutek what is the drawback of late installation of components?

@mateuszrzeszutek
Copy link
Member Author

I wonder if we can keep the Java 8 condition. IIRC (and I likely do not), starting in Java 9, Java classes themselves no longer use j.u.l., instead using a new internal logging API.

That's true, Java 9 introduced the new System.Logger interface that's supposed to be used internally (https://openjdk.java.net/jeps/264) - let's keep the Java 8 condition then.

@trask @mateuszrzeszutek what is the drawback of late installation of components?

Hmm, runtime/JVM metrics starting a bit later? The only risk that I can think of is that LogManager never loads and ComponentInstaller#after...() never gets called, but with all the conditions and checks that we have this is a very minor risk.

@iNikem
Copy link
Contributor

iNikem commented Mar 18, 2021

OpenTelemetryInstaller is also ComponentInstaller. Anything bad happens if its installation is delayed?

@mateuszrzeszutek
Copy link
Member Author

No, because it doesn't override the afterByteBuddyAgent() method - this "delay after LogManager" thing only affects the after... method.

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.

ComponentInstallers should run after LogManager regardless of Java version/JFR presence
3 participants