prometheus / jmx_exporter

A process for exposing JMX Beans via HTTP for Prometheus consumption

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

YANGJINJUE opened this issue · comments

use version: 0.16.0

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

@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 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

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?

@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.

@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