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
Jmx adapter #431
Jmx adapter #431
Conversation
Signed-off-by: Martin Skarsaune <martin@skarsaune.net>
…an be tested 1:1 , a few tests still remain
…when running in mvn
be351bc
to
430438d
Compare
Hey Martin, thanks a tons for all your work and dedication ! Let me try to jump on this, but this might take a bit. Hope to come to this next week, but there's a lot work on my plate these days ;-) But that's all really very cool. Were you able to run this adapter in e.g. jconsole or visualvm ? |
Looking into running in jmc, but that is a big task in itself. No need to rush, I can try the jmc integration with a local snapshot, and it will probably result in adjustments as well. |
…lilitate integration in jmc
… and jvisualvm by adding to classpath (DOES NOT work particularly well at this stage)
Have been testing directly in jconsole and jvisualvm by adding to classpath and using jmx url for example service:jmx:jolokia://localhost:9091/hawtio/jolokia/ |
@skarsaune no worries, don't get lost. I haven't heard many requests about jconsol / jsvisualvm recently, so please focus what you need for your use case. If jvisualvm or jconsole support is requested, it still can be added later. |
wrt to a review, I can't jump on it until the over next week (busy this week, pto next). So please ping me again in case I should forget. Thanks ! |
I will stay on the JConsole track a few more days, it is a nice real world example and the code is easily accessible within the JDK, so it is a fruitful excercise anyway. With regards to review I would hold off a bit, things may change quite a lot. Thought I could label it as draft, but do not find that option. Anyway I can notify when I believe things are more stable. |
…ction as reference connection
…vms, and allow values in payload not covered
Good timing, just back from PTO ;-) (well, if it's good timing we will see when the e-mail backslash will he me :) I will try to find a slot next week to jump on a review ... |
Should be OK to review now. Works with JMC as well. Playlist: https://www.youtube.com/watch?v=PDf2mqxOeMk&list=PLj8NeDWnVAdAu5X5hzioxLdSOhYSvrXTF , feel free to tweet however you like as a list or separately. |
Sorry, didn't make it last week :( So next try is this week .... |
client/jmx-adapter/src/main/java/org/jolokia/client/jmxadapter/RemoteJmxAdapter.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank @skarsaune for this awesome PR and equally for your patience ;)
It looks good to me, with some minor mostly cosmetic comments and suggestions. If you could address these in this week we can merge it (hint: I have PTO for the rest of the week :)
The only thing missing then is documentation, I will have a look where to best hook in documentation for the JmxAdapter.
thanks!
...nt/jmx-adapter/src/main/java/org/jolokia/client/jmxadapter/JolokiaJmxConnectionProvider.java
Outdated
Show resolved
Hide resolved
client/jmx-adapter/src/main/java/org/jolokia/client/jmxadapter/JolokiaJmxConnector.java
Outdated
Show resolved
Hide resolved
Map<String, Object> mergedEnv = mergedEnvironment(env); | ||
String internalProtocol = "http"; | ||
if (String.valueOf(this.serviceUrl.getPort()).endsWith("443") || "true" | ||
.equals(mergedEnv.get("jmx.remote.x.check.stub"))) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any particular reason why the environment is called like this? For me it's not obvious that this environment variable relates to select https as protocol. If this is not a standard variable, maybe we can choose some name which indicates its usage ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you refer to "jmx.remote.x.check.stub"? It is used by JConsole. I can create a named constant if that is the case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. I'm ok with using it literally here, maybe a comment would be nice as it is not obvious that this is defined bei JConsole.
client/jmx-adapter/src/main/java/org/jolokia/client/jmxadapter/JolokiaJmxConnector.java
Outdated
Show resolved
Hide resolved
client/jmx-adapter/src/main/java/org/jolokia/client/jmxadapter/RemoteJmxAdapter.java
Outdated
Show resolved
Hide resolved
client/jmx-adapter/src/main/java/org/jolokia/client/jmxadapter/RemoteJmxAdapter.java
Outdated
Show resolved
Hide resolved
client/jmx-adapter/src/main/java/org/jolokia/client/jmxadapter/RemoteJmxAdapter.java
Outdated
Show resolved
Hide resolved
client/jmx-adapter/src/main/java/org/jolokia/client/jmxadapter/RemoteJmxAdapter.java
Outdated
Show resolved
Hide resolved
client/jmx-adapter/src/main/java/org/jolokia/client/jmxadapter/ToOpenTypeConverter.java
Outdated
Show resolved
Hide resolved
client/jmx-adapter/src/main/java/org/jolokia/client/jmxadapter/ToOpenTypeConverter.java
Show resolved
Hide resolved
…/ToOpenTypeConverter.java Co-authored-by: Roland Huß <rhuss@redhat.com>
…/RemoteJmxAdapter.java Co-authored-by: Roland Huß <rhuss@redhat.com>
…/RemoteJmxAdapter.java Co-authored-by: Roland Huß <rhuss@redhat.com>
…/RemoteJmxAdapter.java Co-authored-by: Roland Huß <rhuss@redhat.com>
…/RemoteJmxAdapter.java Co-authored-by: Roland Huß <rhuss@redhat.com>
@skarsaune thanks a lot ! Looks we are ready to merge now :) Wrt/ the documentation we can add a followup PR, so that we then can make a release. Thanks again for your awesome work! |
Assert.assertEquals( | ||
this.adapter.getDefaultDomain(), nativeServer.getDefaultDomain(), "Default domain"); | ||
|
||
Assert.assertEquals(this.adapter.agentVersion, "1.6.2"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@skarsaune I think this will give us some headaches when releasing. We should either remove this test or make it at parameterised with a property from the pom.xml
Attempt to create a MBeanServerConnection proxy using jolokia as the actual backend, with fairly complete test coverage of what you get out of the box in a Java VM. More third party MBeans can be added to increase test coverage of problematic cases.
Tries to mimic exceptions and response values as closely as possible to JSR-160 connection.
Introduces a new internal dependency to jolokia-core from test to compile in order to reuse mapping to OpenType,
if that dependency is a problem the new adapter can be split out to a separate module.
Also wondering if one should automate tests with different old releases of the Jolokia JVM agent and possibly different JVM versions in github actions, to test permutations of clients and server.