RFR: 7167: Agent Plugin [v9]

Brice Dutheil github.com+803621+bric3 at openjdk.java.net
Sun Jun 20 08:23:29 UTC 2021


On Fri, 18 Jun 2021 17:56:25 GMT, Joshua Matsuoka <jmatsuoka at openjdk.org> wrote:

>> This PR adds the Agent Plugin to JMC. This is a plugin for controlling the jmc agent and provides a way to attach it and add probes to any JVMs in the JVM browser, as well as providing a preset manager for creating/modifying probe presets.
>> 
>> There is still a small amount of cleanup to be done so I'll mark it as a draft for now but it would be great to get a review :)
>
> Joshua Matsuoka has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Resolving an issue with generated XML for field capturing/parameter capturing

So I build upon you latest change ( 8f8398e2bb5e120f2c5dd36f62918cbe945e0a15 ), and indeed this fixes most of the issues.

I have noted a few additional things :

For example if I open the agent on JMC itself

<img width="264" alt="Screenshot 2021-06-20 at 08 49 54" src="https://user-images.githubusercontent.com/803621/122665789-98e8bd80-d1a9-11eb-8938-88c5894972c8.png">

<img width="591" alt="Screenshot 2021-06-20 at 09 23 50" src="https://user-images.githubusercontent.com/803621/122665786-938b7300-d1a9-11eb-83f6-2610d7ddd2f6.png">

The help button on the dialog with the question mark does nothing.

If I only give the agent jar path eg : `agent/target/org.openjdk.jmc.agent-1.0.0-SNAPSHOT.jar`

Then the agent editor is empty:

<img width="884" alt="image" src="https://user-images.githubusercontent.com/803621/122666455-9b4d1680-d1ad-11eb-8ac7-b1ddabd5452f.png">

Then doing something silly I clicked on the save preset and SAX error when saving as the preset is empty.
<img width="575" alt="image" src="https://user-images.githubusercontent.com/803621/122666673-0f3bee80-d1af-11eb-9658-685c660b9275.png">


org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1; Premature end of file.
	at java.xml/com.sun.org.apache.xerces.internal.jaxp.validation.Util.toSAXParseException(Util.java:75)
	at java.xml/com.sun.org.apache.xerces.internal.jaxp.validation.StreamValidatorHelper.validate(StreamValidatorHelper.java:178)
	at java.xml/com.sun.org.apache.xerces.internal.jaxp.validation.ValidatorImpl.validate(ValidatorImpl.java:115)
	at org.openjdk.jmc.console.agent.utils.ProbeValidator.validate(ProbeValidator.java:86)
	at java.xml/javax.xml.validation.Validator.validate(Validator.java:124)
	at org.openjdk.jmc.console.agent.manager.model.Preset.deserialize(Preset.java:147)
	at org.openjdk.jmc.console.agent.editor.AgentEditorUi.savePreset(AgentEditorUi.java:185)
	at org.openjdk.jmc.console.agent.editor.AgentEditorAction.run(AgentEditorAction.java:57)
	at org.eclipse.jface.action.Action.runWithEvent(Action.java:474)
	at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:579)
       ...


Is there no way to stop a running agent and restart the agent, so it's possible to give a different configuration. _I didn't have the time to explore the agent at this time._

application/org.openjdk.jmc.console.agent/src/main/java/org/openjdk/jmc/console/agent/raweditor/internal/XmlDocumentProvider.java line 85:

> 83: 		}
> 84: 
> 85: 		try (Writer writer = new OutputStreamWriter(new FileOutputStream(out), StandardCharsets.UTF_8)) {

I think this should be decorated by `BufferedWriter`. Indeed saving is a manual action, but I believe this is better.

-------------

PR: https://git.openjdk.java.net/jmc/pull/226


More information about the jmc-dev mailing list