Interesting. Looking at the VirtualMachine class...

1. There doesn't appear to be a way to remove the agent once attached, How 
would you handle patching? The JMX exporter uses some singleton classes, so 
you can't run multiple versions.
2. This functionality doesn't require any changes to the JMX exporter. i.e. 
you can write a separate tool outside of the JMX exporter.
3. Attaching with incorrect configuration will cause the JMX exporter to 
signal the VM to exit (System.exit) (While we could remove the System.exit, 
it still doesn't address 1)
4. In my experience, dynamic attachment support hasn't been a requested 
feature.

Thoughts?
On Wednesday, September 13, 2023 at 1:23:48 PM UTC-4 Andrzej Ressel wrote:

> Hi,
>
> Currently jmx_exporter supports java agent and connecting to rmi/jmx 
> server. 
>
> In my case the application is already running with jmx disabled (as in no 
> jmx arguments are set) and since it's in production I cannot restart it to 
> set required arguments.
>
> I've prepared support for connecting to already running application using 
> VirtualMachine::startLocalManagementAgent() 
> <https://docs.oracle.com/en/java/javase/17/docs/api/jdk.attach/com/sun/tools/attach/VirtualMachine.html#startLocalManagementAgent()>
>  and 
> I would like to gather feedback if I should open pull request with that.
>
> Andrzej
>

-- 
You received this message because you are subscribed to the Google Groups 
"Prometheus Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to prometheus-developers+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-developers/a6b27f05-e3ed-4df2-aa0d-721290fdcac6n%40googlegroups.com.

Reply via email to