I'm currently triying to expose Kafka Connect Workers JMX :
Using this docker image :
FROM cnfldemos/cp-server-connect-datagen:0.5.3-7.1.0
ADD --chown=1000:1000 exporterConfig.yml /opt/prometheus-exporter/prom-jmx-agent-config.yml
ADD --chown=1000:1000 jmx_prometheus_javaagent-0.17.0.jar /opt/prometheus-exporter/agent.jar
The JMX Exporter version is the last one from 0
Here is the result logs when the connect worker is starting :
PS D:\env\confluent-platform> docker logs connect -f
===> User
uid=1000(appuser) gid=1000(appuser) groups=1000(appuser)
===> Configuring ...
===> Running preflight checks ...
===> Check if Kafka is healthy ...
Exception in thread "main" java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:513)
at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:525)
Caused by: java.lang.NoSuchFieldError: UNKNOWN
at io.prometheus.jmx.JmxCollector$Rule.<init>(JmxCollector.java:57)
at io.prometheus.jmx.JmxCollector.loadConfig(JmxCollector.java:214)
at io.prometheus.jmx.JmxCollector.<init>(JmxCollector.java:91)
at io.prometheus.jmx.JavaAgent.premain(JavaAgent.java:29)
... 6 more
*** java.lang.instrument ASSERTION FAILED ***: "result" with message agent load/premain call failed at src/java.instrument/share/native/libinstrument/JPLISAgent.c line: 422
FATAL ERROR in native method: processing of -javaagent failed, processJavaStart failed
This java.lang.NoSuchFieldError make me think about dependency conflict issue,
I got through the code of JMX Exporter & its simpleclient dependency
indeed the UNKNOWN Type enum value from simpleclient dependency in Collector.java class only appeared after version 10, and 14 is the dependency version number in JMX Exporter.
But i took the source code of the cnfldemos/cp-server-connect-datagen and i was not able to find any reference to this dependency package.
Any advice welcome !