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

Be compatible with IBM JDK in a lenient way #174

Closed
davidkarlsen opened this issue Jan 10, 2017 · 1 comment
Closed

Be compatible with IBM JDK in a lenient way #174

davidkarlsen opened this issue Jan 10, 2017 · 1 comment

Comments

@davidkarlsen
Copy link
Contributor

davidkarlsen commented Jan 10, 2017

DefaultExports.initialize() will add register (among other) StandardExports.
StandardExports has two com.sun.management classes.
It will fail on a IBM JDK with:

[1/10/17 10:19:50:691 CET] 00000021 com.ibm.ws.webcontainer.webapp                               E SRVE0283E: Exception caught while initializing context: java.lang.ClassCastException: com.ibm.lang.management.UnixExtendedOperatingSystem incompatible with com.sun.management.OperatingSystemMXBean
        at io.prometheus.client.hotspot.StandardExports.<init>(StandardExports.java:43)
        at io.prometheus.client.hotspot.DefaultExports.initialize(DefaultExports.java:23)

I think it would be better to

  1. use java.lang.managment where possible, and where it does not provide the additional metrics we want:
  2. use some classload-test to see if the classes are available, and if not, skip registering.
@brian-brazil
Copy link
Contributor

Default exports is in the Hotspot module, and thus doesn't support non-Hotspot JVMs such as IBM's.

use java.lang.managment where possible, and where it does not provide the additional metrics we want:

We do this a but, however this isn't part of the Java spec and thus varies across JVM implementations. Basically we're hardcoding to what Hotspot provides.

use some classload-test to see if the classes are available, and if not, skip registering.

I was informed this wouldn't work, but if you can get it working that'd be great.

davidkarlsen added a commit to davidkarlsen/client_java that referenced this issue Jan 11, 2017
brian-brazil pushed a commit that referenced this issue Jan 19, 2017
* Invoke processCpuTime with reflection to bridge ibm/sun diffs

Fixes #174
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants