-
Notifications
You must be signed in to change notification settings - Fork 323
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
Binary execution support #903
Binary execution support #903
Conversation
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.
Thanks a lot!! This is great stuff!
I didn't really review, as this is still marked WIP. Only looked for general stuff, mainly trying to answer why the core java stuff is not instrumented (not sure if you mean it doesn't work in the unit tests or the WildFly test).
So, first you need to add an exception for the instrumented types to where we say java.
package should be ignored. Also, see the review comments- make sure the instrumentation classes are properly listed in the services file and that you are not filtering out the classes you want instrumented, eg the class loading filter.
Use DEBUG
log level to see which advices are applied and whether there were type matches and method matches.
More general things- any instrumentation that looks for implementations of interfaces or sub-classes of types should contain a "cheap" implementation of getTypeMatcherPreFilter()
(eg based on class name), otherwise startup times will be greatly affected.
Apart from that- the extraction of common code is great, but I would separate classes so that each API is handled through a different instrumentation class.
Lastly- what you did for testing with WildFly is a valid option, but you can also use a basic Java image with a basic Java application that starts transactions through the agent APIs and executes commands as spans.
...s/apm-cmd-plugin/src/main/java/co/elastic/apm/agent/cmd/ReferenceStoringInstrumentation.java
Outdated
Show resolved
Hide resolved
...ugin/src/main/resources/META-INF/services/co.elastic.apm.agent.bci.ElasticApmInstrumentation
Outdated
Show resolved
Hide resolved
Hi @theobisproject this is a great PR, I'd like to give a hand to move this forward. As there are quite a few things to change, I think the best way to proceed would be to submit a PR against your fork branch. I will try to make the commits as self explanatory as possible. Are you OK with that ? I have a question regarding commons-exec library (which I'm not very familiar with), as it relies on One extra benefit of only instrumenting |
Hi @SylvainJuge I'm okay with PR's against my branch. I'm currently quite stuck with the insturmentation of the Java API's and are happy to get some help. Here ist the latest patch of me trying to get the Java process builder api to work Latest_work_for_supporting_Java_process_builder_api.patch.txt. Support of commons-exec is mainly motivated because we use it heavily in our application and the Java API intrumentation didn't work. I would be ok to insturment commons-exec via the |
@theobisproject I have pushed a PR to your fork (theobisproject#1), I've tried to make the commit history intelligible, but don't hesitate to ask if you have any questions. Instrumentation is now in the It was definitely more tricky than expected, and we found a few things to improve to help further contributions, thus definitely worth to push forward ! |
@SylvainJuge I tried your change and the Java APIs + commons exec synchronous API works. Great job! Will have a look at the code later. Executor executor = new DefaultExecutor();
DefaultExecuteResultHandler handler = new DefaultExecuteResultHandler();
executor.execute(new CommandLine("java").addArgument("-version"), handler);
handler.waitFor(); What would be the plan going forward from here? I initially planned to also get the arguments of the call as well as the return code of the process. Should we separate this from the changes here? |
Thanks for checking on your side. I will try to reproduce the issue with asynchronous execution with commons-exec to see where the problem is. One limitation of the current implementation is that we don't instrument What is likely to happen, is that the I will need to investigate a bit to see how we could provide dedicated support for this with |
We should have a way to make plugins define which classes they need to instrument, probably requiring an explicit naming for classes that are loaded from bootstrap classloader in (java.*,sun.*, ...)
@SylvainJuge Have you planned to do the proposed changes in another pull request against my branch. I ask because I won't be that much available from Monday on until next year. @eyalkoren Would it be possible to merge the current state (including the incubating status) and improve the functionality by additional pull requests? |
Yes, I'm currently doing those changes, and I can push and merge the PR
without any extra action required on your side. But I can't do it today.
Thanks for keeping us updated on your availability, that's really kind of
you! Enjoy your end of the year vacations.
…On Fri, Dec 13, 2019, 10:57 theobisproject ***@***.***> wrote:
@SylvainJuge <https://github.com/SylvainJuge> Have you planned to do the
proposed changes in another pull request against my branch. I ask because I
won't be that much available from Monday on until next year.
@eyalkoren <https://github.com/eyalkoren> Would it be possible to merge
the current state (including the incubating status) and improve the
functionality by additional pull requests?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#903?email_source=notifications&email_token=AAF2JSSPU6H6SY3NF5GXU73QYNMBVA5CNFSM4JFCMVX2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEGZPY4Y#issuecomment-565378163>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAF2JSQFR5WQADTSOHZNP73QYNMBVANCNFSM4JFCMVXQ>
.
|
jenkins, please run the tests |
95a26df
to
41b55db
Compare
Support for calls to external binaries. Fixes #767.
Code is currently a little messy but the commons-exec library works.
@felixbarny @eyalkoren I need some help with the Java APIs. Even removing all ignores from the Agent the classes where not instrumented. Maybe I have done something wrong?
Integration Tests for the Java API still has to be created. Any advice on this? Currently I'm using a REST-Resource deployed on Wildfly to test this change.
Checklist
Open for discussion