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

Allow plugins to instrument bootstrap classes without modifying agent core #952

Closed
SylvainJuge opened this issue Dec 2, 2019 · 1 comment
Labels
technical-debt Technical debt
Milestone

Comments

@SylvainJuge
Copy link
Member

Is your feature request related to a problem? Please describe.

By default, classes in java.*, com.sun.* and sun.* are excluded from being instrumented.
There is a hard-coded list of classes that are allowed for instrumentation, for example in ElasticApmAgent#getAgentBuilder(...) :

  • *URLConnection for jdk http client instrumentation
  • all classes in java.util.concurrent

Thus, for all plugins that instrument those classes, we need to modify this hard-coded list to allow class instrumentation. Failure to do so results in classes being ignored and lots of time spent debugging plugin and trying to figure out why.

Describe the solution you'd like

For the classes in those packages, each plugin should provide a list of classes that should not be filtered out for instrumentation.

There might be multiple ways to implement this:

  • using an explicit list with fully qualified names (strict, but definitely doable for classes in JDK)
  • reusing bytebuddy matchers with an expression that will enable those classes for instrumentation (allows to avoid using fully-qualified names).
  • reusing existing class matcher and dynamically adding exclusion to the existing white-listing: transparent from plugins, but any plugin matcher should not be too broad.
@SylvainJuge SylvainJuge added the technical-debt Technical debt label Dec 2, 2019
@SylvainJuge SylvainJuge added this to the 7.7 milestone Mar 10, 2020
@eyalkoren eyalkoren modified the milestones: 7.7, 7.8 Apr 2, 2020
@felixbarny
Copy link
Member

felixbarny commented Jun 18, 2020

In 6abbf01 (part of #1230) I've removed the default java.*, com.sun.*, and sun.* from the default excludes. I've just added them specifically to the trace_methods instrumentation.

@SylvainJuge SylvainJuge modified the milestones: 7.8, 7.9 Jul 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
technical-debt Technical debt
Projects
None yet
Development

No branches or pull requests

3 participants