Skip to content
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

7167: Agent Plugin #226

Closed
wants to merge 16 commits into from
Closed

Conversation

Josh-Matsuoka
Copy link
Collaborator

@Josh-Matsuoka Josh-Matsuoka commented Mar 10, 2021

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 :)


Progress

  • Commit message must refer to an issue
  • Change must be properly reviewed

Issue

Reviewers

Contributors

  • Alex Macdonald <aptmac@openjdk.org>
  • Jessye Coleman-Shapiro <jescolem@openjdk.org>
  • Kangcheng Xu <kxu@openjdk.org>

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jmc pull/226/head:pull/226
$ git checkout pull/226

Update a local copy of the PR:
$ git checkout pull/226
$ git pull https://git.openjdk.java.net/jmc pull/226/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 226

View PR using the GUI difftool:
$ git pr show -t 226

Using diff file

Download this PR as a diff file:
https://git.openjdk.java.net/jmc/pull/226.diff

@bridgekeeper
Copy link

bridgekeeper bot commented Mar 10, 2021

👋 Welcome back jmatsuoka! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@Josh-Matsuoka
Copy link
Collaborator Author

/contributor add aptmac
/contributor add jescolem
/contributor add kxu

@openjdk
Copy link

openjdk bot commented Mar 10, 2021

@Josh-Matsuoka
Contributor Alex Macdonald <aptmac@openjdk.org> successfully added.

@openjdk
Copy link

openjdk bot commented Mar 10, 2021

@Josh-Matsuoka
Contributor Jessye Coleman-Shapiro <jescolem@openjdk.org> successfully added.

@openjdk
Copy link

openjdk bot commented Mar 10, 2021

@Josh-Matsuoka
Contributor Kangcheng Xu <kxu@openjdk.org> successfully added.

@thegreystone
Copy link
Member

thegreystone commented Mar 12, 2021

New plug-ins must have both 16x16 and 32x32 pixel versions of icons, and preferably also either a vector version, or a higher resolution variant checked into jmc-graphics. Let me know if you need help inventing something. :)

@Josh-Matsuoka
Copy link
Collaborator Author

I see. Do you have any ideas/preferences for what the icon should look like for the agent plugin?

@thegreystone
Copy link
Member

I see. Do you have any ideas/preferences for what the icon should look like for the agent plugin?

Hm. We've been talking about extending the agent with other stuff (i.e. not directly related to the JFR), so something JMC-ish? Rocket with sunglasses (since all agents have sunglasses)? Or just an agent icon (hat + sunglasses?).

@Josh-Matsuoka Josh-Matsuoka marked this pull request as ready for review March 29, 2021 18:32
@openjdk openjdk bot added the rfr label Mar 29, 2021
@mlbridge
Copy link

mlbridge bot commented Mar 29, 2021

@thegreystone
Copy link
Member

/reviewers 2

@openjdk
Copy link

openjdk bot commented Mar 31, 2021

@thegreystone
The number of required reviews for this PR is now set to 2 (with at least 1 of role committers).

@thegreystone thegreystone requested review from Gunde and guruhb April 9, 2021 14:40
@thegreystone
Copy link
Member

Since this is part of the core rcp distribution (not an optional downloadable plug-in), I think you can skip the "ext".

@thegreystone
Copy link
Member

Failing validation checks.

@Josh-Matsuoka
Copy link
Collaborator Author

@mirage22 @bric3 I've updated the PR, there were a couple of spots that got missed by eclipse when I was renaming everything and removing the exts. For whatever reason my local build worked but making a fresh build didn't, so I missed that, apologies. It's been fixed now and should work as expected

@Josh-Matsuoka
Copy link
Collaborator Author

I've a seems replacing the current agent didn't work, Is this desired behaviour ?

This sounds like a possible agent bug, I'll take a look and get back to you on that

@mirage22
Copy link
Collaborator

mirage22 commented Jun 15, 2021

@Josh-Matsuoka seems build works nicelly ! Thank you but the "org.openjdk.jmc.console.agen" module is still not properly displayed in side the Eclipse as Java project, sadly, there is something some where missing.

btw: agent definition on void methods without inputs ()V , works properly, I've done a mistake.

@bric3
Copy link
Collaborator

bric3 commented Jun 17, 2021

@Josh-Matsuoka I will look at it by the end of this week.

Copy link
Collaborator

@bric3 bric3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I build upon you latest change ( 8f8398e ), 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

Screenshot 2021-06-20 at 08 49 54

Screenshot 2021-06-20 at 09 23 50

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:

image

Then doing something silly I clicked on the save preset and SAX error when saving as the preset is empty.
image

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.

@Josh-Matsuoka
Copy link
Collaborator Author

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

That help button should just be hidden, the textbox hints already tell the user exactly what's needed

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:

This is intended behaviour, there are no probes inserted, so there's nothing to display

Then doing something silly I clicked on the save preset and SAX error when saving as the preset is empty.

We should have a more meaningful error if the preset is empty, I'll fix that

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.

Not to stop/restart a running agent, but defineEventProbes already reverts existing instrumentation and inserts new probes (i.e. it will override the current configuration).

@Josh-Matsuoka
Copy link
Collaborator Author

@bric3 PR has been updated with the requested changes, let me know what you think when you get some time :)

Copy link
Collaborator

@bric3 bric3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes it looks good to me.

IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
DialogToolkit.showWarning(window.getShell(), Messages.AgentEditorUI_MESSAGE_EMPTY_PRESET_TITLE,
Messages.AgentEditorUI_MESSAGE_EMPTY_PRESET);
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@@ -61,6 +62,8 @@
public StartAgentWizard(AgentJmxHelper helper) {
this.helper = helper;
startAgentWizardPage = new StartAgentWizardPage(helper);
this.setHelpAvailable(false);
WizardDialog.setDialogHelpAvailable(false);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@Josh-Matsuoka
Copy link
Collaborator Author

@Gunde mind taking another look when you get some time? :)

@openjdk
Copy link

openjdk bot commented Jun 30, 2021

@Josh-Matsuoka This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

7167: Agent Plugin

Co-authored-by: Alex Macdonald <aptmac@openjdk.org>
Co-authored-by: Jessye Coleman-Shapiro <jescolem@openjdk.org>
Co-authored-by: Kangcheng Xu <kxu@openjdk.org>
Reviewed-by: hirt, jkang

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 43 new commits pushed to the master branch:

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk bot added the ready label Jun 30, 2021
@thegreystone thegreystone self-requested a review July 7, 2021 17:07
@aptmac
Copy link
Member

aptmac commented Jul 7, 2021

Thanks for all the reviews everyone, I'll integrate this shortly on behalf of Josh

@aptmac
Copy link
Member

aptmac commented Jul 7, 2021

/integrate

@openjdk
Copy link

openjdk bot commented Jul 7, 2021

@aptmac Only the author (@Josh-Matsuoka) is allowed to issue the integrate command.

@aptmac
Copy link
Member

aptmac commented Jul 7, 2021

@aptmac Only the author (@Josh-Matsuoka) is allowed to issue the integrate command.

Jokes on me, I'll send him a ping to do so

@Josh-Matsuoka
Copy link
Collaborator Author

/integrate

@openjdk
Copy link

openjdk bot commented Jul 7, 2021

Going to push as commit 2e8a251.
Since your change was applied there have been 44 commits pushed to the master branch:

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot closed this Jul 7, 2021
@openjdk openjdk bot added integrated and removed ready rfr labels Jul 7, 2021
@openjdk
Copy link

openjdk bot commented Jul 7, 2021

@Josh-Matsuoka Pushed as commit 2e8a251.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

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

Successfully merging this pull request may close these issues.

7 participants