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

Don't instrument well behaved spring class loaders #1785

Merged
merged 2 commits into from
Aug 24, 2020

Conversation

bantonsson
Copy link
Contributor

@bantonsson bantonsson commented Aug 19, 2020

As part of #1293 we started instrumenting a couple of spring class loaders that all delegate class loading properly. This can have a big impact on application startup time in some cases.

@bantonsson bantonsson self-assigned this Aug 19, 2020
@bantonsson bantonsson changed the title WIP only using CI to test changes Don't instrument well behaved spring class loaders Aug 19, 2020
@bantonsson bantonsson marked this pull request as ready for review August 19, 2020 15:50
@bantonsson bantonsson requested a review from a team as a code owner August 19, 2020 15:50
@@ -45,7 +45,12 @@ public ClassloadingInstrumentation() {
return namedNoneOf(
"java.lang.ClassLoader",
"com.ibm.oti.vm.BootstrapClassLoader",
"datadog.trace.bootstrap.AgentClassLoader")
"datadog.trace.bootstrap.AgentClassLoader",
Copy link
Member

Choose a reason for hiding this comment

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

Nice.

if (name.startsWith("org.springframework.core.task.")
|| name.equals("org.springframework.core.DecoratingClassLoader")
|| name.equals("org.springframework.core.OverridingClassLoader")) {
if (name.startsWith("org.springframework.core.task.")) {
Copy link
Member

Choose a reason for hiding this comment

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

It's not new but this bugs me, I think we could implement a trie without much effort and probably do better here.

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 I completely agree.

@@ -45,7 +45,12 @@ public ClassloadingInstrumentation() {
return namedNoneOf(
"java.lang.ClassLoader",
"com.ibm.oti.vm.BootstrapClassLoader",
"datadog.trace.bootstrap.AgentClassLoader")
"datadog.trace.bootstrap.AgentClassLoader",
Copy link
Member

Choose a reason for hiding this comment

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

datadog.trace.bootstrap.AgentClassLoader no longer exists. I wonder how long this has been like this for?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think it should be updated to this: datadog.trace.bootstrap.DatadogClassLoader

Copy link
Member

Choose a reason for hiding this comment

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

Also datadog.trace.bootstrap.DatadogClassLoader$DelegateClassLoader

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Wonderful

Copy link
Member

Choose a reason for hiding this comment

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

Can we change this before merging?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Absolutely

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Turns out that they are already taken care of by datadog.trace.agent.tooling.ClassLoaderMatcher.SkipClassLoaderMatcher.canSkipClassLoaderByName.

Copy link
Member

Choose a reason for hiding this comment

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

Do we need to rationalise this logic? We seem to match classloaders in so many places.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I only count to 3 right now 😉

@richardstartin richardstartin self-requested a review August 20, 2020 16:14
@bantonsson bantonsson merged commit 47310f2 into master Aug 24, 2020
@bantonsson bantonsson deleted the ban/spring_class_loaders branch August 24, 2020 09:09
@github-actions github-actions bot added this to the 0.61.0 milestone Aug 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants