-
Notifications
You must be signed in to change notification settings - Fork 324
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
Indy plugins #1230
Indy plugins #1230
Conversation
… writing to field
Migrate more plugins
- Add AssignTo annotation to assign to different targets by returning an Object[] - Add GlobalState annotation - Create ThreadLocalRegistry to easily construct global thread locals - Patch class file version to at least 51 (Java 7) in order to be able to insert invokedynamic instructions - Load the whole package of the Advice class from a dedicated plugin classloader that's a child of the classloader of the instrumented class - Depend on byte-buddy-dep and manually shade asm so that we can use asm-commons
- Rename helper class loader to plugin class loader - Add GlobalVariables registry
Some are currently failing see raphw/byte-buddy#880
As said during the meeting we had today:
|
- Fix matcher for ForkJoinPool - Add support for parallel streams - Simplify testing of bootstrap instrumentations - Remove java.* from the default exclusions - Disallow agent types in advice signature - Enable previously disabled async Dubbo tests
allow agent classes to be instrumented
- Don't start agent on early J9 versions that crash on indy bootstrap - Fix location strategy order to avoid ClassNotFoundExceptions on Payara
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Epic PR!! That's really a whole new agent technology!
First review chunk - looks great so far, didn't find anything major, a few minor comments/suggestions/questions.
apm-agent-core/src/main/java/co/elastic/apm/agent/bci/ElasticApmInstrumentation.java
Show resolved
Hide resolved
apm-agent-core/src/main/java/co/elastic/apm/agent/bci/bytebuddy/postprocessor/AssignTo.java
Show resolved
Hide resolved
apm-agent-core/src/main/java/co/elastic/apm/agent/bci/ElasticApmInstrumentation.java
Outdated
Show resolved
Hide resolved
apm-agent-core/src/main/java/co/elastic/apm/agent/bci/ElasticApmInstrumentation.java
Outdated
Show resolved
Hide resolved
apm-agent-core/src/main/java/co/elastic/apm/agent/bci/ElasticApmAgent.java
Show resolved
Hide resolved
apm-agent-core/src/main/java/co/elastic/apm/agent/bci/IndyBootstrap.java
Outdated
Show resolved
Hide resolved
apm-agent-core/src/main/java/co/elastic/apm/agent/util/PackageScanner.java
Outdated
Show resolved
Hide resolved
apm-agent-core/src/main/java/co/elastic/apm/agent/util/PackageScanner.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Chunk 2, a smaller one today...
...t-core/src/main/java/co/elastic/apm/agent/bci/methodmatching/TraceMethodInstrumentation.java
Outdated
Show resolved
Hide resolved
apm-agent-core/src/main/java/co/elastic/apm/agent/threadlocal/RemoveOnGetThreadLocal.java
Outdated
Show resolved
Hide resolved
apm-agent-core/src/test/java/co/elastic/apm/agent/bci/InstrumentationTest.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
Did we get to a threshold of doing more non-inlined than inlined? If so, can and should we configure BB to not-inline by default and explicitly define only when we want to inline?
...ins/apm-dubbo-plugin/src/test/java/co/elastic/apm/agent/dubbo/api/impl/DubboTestApiImpl.java
Show resolved
Hide resolved
...concurrent-plugin/src/main/java/co/elastic/apm/agent/concurrent/ExecutorInstrumentation.java
Show resolved
Hide resolved
...concurrent-plugin/src/main/java/co/elastic/apm/agent/concurrent/ExecutorInstrumentation.java
Show resolved
Hide resolved
...m-java-concurrent-plugin/src/test/java/co/elastic/apm/agent/concurrent/ForkJoinPoolTest.java
Show resolved
Hide resolved
assertThat(Stream.of("foo", "bar", "baz") | ||
.parallel() | ||
.<AbstractSpan<?>>map(s -> tracer.getActive()) | ||
.distinct()) | ||
.containsExactly(transaction); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe even more explicit is:
assertThat(Stream.of("foo", "bar", "baz") | |
.parallel() | |
.<AbstractSpan<?>>map(s -> tracer.getActive()) | |
.distinct()) | |
.containsExactly(transaction); | |
assertThat(Stream.of("foo", "bar", "baz") | |
.parallel() | |
.<AbstractSpan<?>>map(s -> tracer.getActive())) | |
.containsExactly(transaction, transaction, transaction); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True, but I don't want to execute the tests again because of that.
Uses Byte Buddy's new ability to dispatch to advices via
INVOKEDYNAMIC
.Excerpt from the Javadoc of
IndyBootstrap
:First step of #1085
Supersedes #1090
Refactors the JDBC and Servlet plugin to be indy plugins. Prepares some more plugins for easy migration to indy plugins.