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

Make the agent attachable to a running VM #280

Merged
merged 1 commit into from Jun 14, 2018

Conversation

Projects
None yet
2 participants
@picadoh
Contributor

picadoh commented Jun 11, 2018

By adding the agentmain method, we enable the ability of attaching
the JMX Exporter Java Agent to a JVM after the VM starts, providing
a more dynamic approach to managing thousands of deployed VMs.

Usage example:

VirtualMachine vm = VirtualMachine.attach(processPID);
vm.loadAgent("./jmx_prometheus_javaagent-0.3.2.jar=8080:config.yaml");
vm.detach();

Important to note that this change does not break any of the existing behaviours of the agent nor it adds any extra responsibility to it, it only enables this ability on top of it.

@brian-brazil Can you please review? Could this be something that we could add to the agent?

@brian-brazil

This comment has been minimized.

Member

brian-brazil commented Jun 12, 2018

What are you imagining the lifecycle as here? This seems pretty fragile to me due to the extra moving parts, a java agent does the same without that issue.

@picadoh

This comment has been minimized.

Contributor

picadoh commented Jun 12, 2018

Thanks for your reply @brian-brazil. I'd like to highlight that this change does not alter the way JMX exporter works, but it makes it easy to attach it dynamically to a JVM (instead of only statically). That will facilitate the upgrade of the agent JAR in entire infrastructure thus improving the operational productivity of the teams.

@brian-brazil

This comment has been minimized.

Member

brian-brazil commented Jun 13, 2018

Why not restart the applications? That's something you generally should have the capability to do.

@picadoh

This comment has been minimized.

Contributor

picadoh commented Jun 13, 2018

The applications will be "eventually" restarted, but as soon as they are, the latest version of the agent will be attached automatically by another piece of infrastructure, removing the need to maintain the config management of these Java options.

@brian-brazil

This comment has been minimized.

Member

brian-brazil commented Jun 14, 2018

That sounds like a sane, though advanced, setup. I say we change the pom, but keep this undocumented. I can see users tying themselves in knots with this feature.

Make the agent attachable to a running VM
By adding the agentmain method, we enable the ability of attaching
the JMX Exporter Java Agent to a JVM after the VM starts, providing
a more dynamic approach to managing thousands of deployed VMs.

Usage example:
```
VirtualMachine vm = VirtualMachine.attach(processPID);
vm.loadAgent("./jmx_prometheus_javaagent-0.3.2.jar=8080:config.yaml");
vm.detach();
```

Signed-off-by: Hugo Picado <hugo.pcd@gmail.com>

@picadoh picadoh force-pushed the picadoh:master branch from f141d42 to e70a5ce Jun 14, 2018

@picadoh

This comment has been minimized.

Contributor

picadoh commented Jun 14, 2018

Thanks @brian-brazil. Makes sense. I just made it undocumented.

@brian-brazil brian-brazil merged commit 8b56f89 into prometheus:master Jun 14, 2018

1 check passed

DCO All commits have a DCO sign-off from the author
Details
@brian-brazil

This comment has been minimized.

Member

brian-brazil commented Jun 14, 2018

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment