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

The metric jvm_memory_used_bytes transitioned to jvm_memory_bytes_used starting from a certain version of jmx_exporter? #909

Closed
YANGJINJUE opened this issue Jan 25, 2024 · 7 comments

Comments

@YANGJINJUE
Copy link

use version: 0.16.0

@YANGJINJUE
Copy link
Author

use version: 0.16.0。jdk21. The presence of -1.0 in the expression jvm_memory_bytes_max{area="nonheap",} -1.0. why?

@dhoard
Copy link
Collaborator

dhoard commented Jan 26, 2024

@YANGJINJUE 0.16.0 shipped with the Prometheus client_java 0.11.0 library, which may have introduced the change.

I suggest you upgrade to the latest version 0.20.0 and adjust your dashboards.

@YANGJINJUE
Copy link
Author

@YANGJINJUE 0.16.0 shipped with the Prometheus client_java 0.11.0 library, which may have introduced the change.

I suggest you upgrade to the latest version 0.20.0 and adjust your dashboards.

use: jmx_prometheus_javaagent-0.20.0.jar use: jdk21, error: Exception in thread "main" java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:118)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:560)
at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:572)
Caused by: java.lang.NoSuchMethodError: 'io.prometheus.jmx.shaded.io.prometheus.client.Collector io.prometheus.jmx.BuildInfoCollector.register()'
at io.prometheus.jmx.JavaAgent.premain(JavaAgent.java:54)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
... 3 more
*** java.lang.instrument ASSERTION FAILED ***: "!errorOutstanding" with message Outstanding error when calling method in invokeJavaAgentMainMethod at open/src/java.instrument/share/native/libinstrument/JPLISAgent.c line: 627
*** java.lang.instrument ASSERTION FAILED ***: "success" with message invokeJavaAgentMainMethod failed at open/src/java.instrument/share/native/libinstrument/JPLISAgent.c line: 466
*** java.lang.instrument ASSERTION FAILED *: "result" with message agent load/premain call failed at open/src/java.instrument/share/native/libinstrument/JPLISAgent.c line: 429
FATAL ERROR in native method: processing of -javaagent failed, processJavaStart failed
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V [libjvm.dylib+0x53ecac] jni_FatalError+0xdc
V [libjvm.dylib+0x6ae64c] JvmtiExport::post_vm_initialized()+0x2dc
V [libjvm.dylib+0x9bd22c] Threads::create_vm(JavaVMInitArgs
, bool
)+0x79c
V [libjvm.dylib+0x55b994] JNI_CreateJavaVM+0x68
C [libjli.dylib+0xa9f4] JavaMain+0x104
C [libjli.dylib+0xd8d0] ThreadJavaMain+0xc
C [libsystem_pthread.dylib+0x7034] _pthread_start+0x88

@aestebangarcianavas
Copy link

We are also using 0.20.0 and it doesn't work with Java 21. There is no update of this issue since one month. Are you planing to fix it?

@dhoard
Copy link
Collaborator

dhoard commented Feb 28, 2024

@YANGJINJUE

Caused by: java.lang.NoSuchMethodError: 'io.prometheus.jmx.shaded.io.prometheus.client.Collector io.prometheus.jmx.BuildInfoCollector.register()'

typically happens if you have multiple versions of the jar somewhere in your classpath. The JVM is loading classes from different jars that mismatched/out of sync.

@dhoard
Copy link
Collaborator

dhoard commented Feb 28, 2024

@aestebangarcianavas can please elaborate? The code has been tested and works on...

  • amazoncorretto:21
  • azul/zulu-openjdk:21
  • bellsoft/liberica-openjdk-debian:21
  • bitnami/java:21
  • eclipse-temurin:21
  • eclipse-temurin:21-alpine
  • openjdk:21
  • sapmachine:21
  • Oracle JDK 21

@brandizzi
Copy link

For those confused by this: the Prometeus client_java library changed the name of the metrics from its 0.16 version to 1.0 version: https://github.com/prometheus/client_java/blob/main/docs/content/migration/simpleclient.md#jvm-metrics. You can consult the list of the changed names in the link above.

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

No branches or pull requests

4 participants