-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
[GR-55707] Java Agents Support in Native Image #8177
Comments
@alina-yur, Is there any coordinated effort from Oracle to resolve this issue? I see there is an open PR but I think it is not addressed by current maintainers of the project. At the end of that effort that PR might be not accepted as well. Is it not a good idea to review that PR and making a better way? It sounds probably strange but after that PR resolved adoption of the Graal will increase dramatically. Many companies are using agents for APM tools and every single release we are reading release notes to see that this issue resolved or not. |
I think you need to reset your expectations of any 'solution'. The qualifications Olga mentioned are not just something to be 'resolved' by a clever redesign. They are intrinsic to what can be achieved here -- because they rule out things that many agents rely on being able to do (there are more issues -- for example, agents that depend on creating service threads under their premain method). In consequence there will be a lot of cases where agents that are used at runtime on the JVM cannot be used at build time to modify behaviour of a generated native image. As an example, my agent, Byteman, as currently designed, cannot possibly be used to instrument a native image at build time. I am not going to say it is impossible to implement an equivalent for GraalVM Native but I currently don't know how to do it (and, yes, I designed and implemented all the core functionality of Byteman). My expectation is that my (many thousands of) users who rely on using Byteman for testing, tracing and debugging are never going to be able to use it for those purposes with a GraalVM Native app. Luckily, my users can still benefit from using Byteman on the JVM during development and maintenance of a GraalVM Native app and the tight equivalence in behaviour of a GraalVM Native vs JVM deployment means they can still test, trace and debug most problems that way. However, I do have a significant number of users who rely on Byteman to troubleshoot problems in live deployments and they are out of luck if they choose to deploy using GraalVM Native. That said, I fully accept that there are agents where build time vs runtime instrumentation makes no difference. So that means a resolution of this issue would be very welcome. Just remember that any such solution will not be universal. |
I am very concerned about when this feature will be implemented? |
From the GraalVM Workshop: we should prevent the agent from transforming the JDK classes in the host VM as they can affect how the image builder works. To allow transformation of JDK classes we can take all classes that are not substituted and apply the transformation ourselves, similarly to Native Image annotations. For inspiration we can use the snippet from NetBeans as proposed by @JaroslavTulach. |
There may be another use-case for this automatic(?) When the use of It transforms the (usually native) methods annotated by Just FYI. CCing @patrick96 |
This ticket summarizes the current status and next steps for Java agent support in Native Image.
Current status
At build time, bytecode transformation can be done by passing a Java agent to Native Image with -J-javaagent:agent.jar. Things to note:
Goals
Non-goals
The text was updated successfully, but these errors were encountered: