trace-agent icon indicating copy to clipboard operation
trace-agent copied to clipboard

Attach the Agent to a running process

Open bimalc opened this issue 4 years ago • 2 comments

With this change we will be able to attach the agent to a running java process and install all the action and see the messages without have to restart the process.

bimalc avatar Mar 18 '21 02:03 bimalc

Thanks for your contribution! :) This is extremely valuable!

But I have to spend some time with it. This new dependency (com.sun:tools:1.8.0) makes me cautious.

Although I might have a solution. Let me share with you I am very interested about your opinion. The tools jar is only needed for the AgentLoader, right? What about transforming the project to multi module maven project. One child project created from the old part containing the instrumenting and logging would still depend on the old dependencies (which is not much). The other child would contain the AgentLoader. Sooner or later we need to make this as meaningful testing only can be done via integration tests. That will be the 3rd child.

WDYT?

attilapiros avatar Mar 19 '21 01:03 attilapiros

Hi Attila,

Yes, this needs caution and I also just experimented with this feature and was using since we last talked in around September. Now when I got time to merge it back these questions needs to be addressed.

So yes the tools jar is only needed for the AgentLoader, and transforming the project to multi module maven project will be a good idea to keep it separate.

Few things about tools.jar is that the tools.jar at the runtime should be exactly the same version of the java being used to run the running process. So irrespective of me compiling it with 1.8.0 I use the tools.jar from exact jdk being used to run program and it works. So this will again need some testing to see if really we need to have a version dependency on this or what is the best approach here. The Agentloader is happy as long as the running jvm and the tools.jar on classpath is from same version.

I will also look into these aspects this weekend and update you.

Thanks & Regards Bimal

On Thu, Mar 18, 2021 at 8:35 PM Attila Zsolt Piros @.***> wrote:

Thanks for your contribution! :) This is extremely valuable!

But I have to spend some time with it. This new dependency (com.sun:tools:1.8.0) makes me cautious.

Although I might have a solution. Let me share with you I am very interested about your opinion. The tools jar is only needed for the AgentLoader, right? What about transforming the project to multi module maven project. One child project created from the old part containing the instrumenting and logging would still depend on the old dependencies (which is not much). The other child would contain the AgentLoader. Sooner or later we need to make this as meaningful testing only can be done via integration tests. That will be the 3rd child.

WDYT?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/attilapiros/trace-agent/pull/13#issuecomment-802446743, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEW6URFHZXC37Z7PMAEJEFDTEKS6TANCNFSM4ZLXPU4A .

bimalc avatar Mar 19 '21 15:03 bimalc