-
Notifications
You must be signed in to change notification settings - Fork 169
Description
Component(s)
jmx-metrics
What happened?
Description
The transformation closure feature, and thus the ability to utilize non-numeric metrics, is not working. The feature was added via !960 but I believe some interaction with !949 is causing the problem. Not sure if this is the cause but InstrumentHelper.groovy is invoking the static MBeanHelper.getBeanAttribute which ignores transformations.
Steps to Reproduce
Run a simple Java program that waits forever and exposes a JMX port.
Run the jmx gatherer with the following groovy collection script:
`def jvmMetrics = otel.mbean("java.lang:type=Runtime",
["my.mbean.jvm.vendor": { mbean -> mbean.getProperty("VmVendor") == "Eclipse Adoptium" ? 1 : 0 }]
)
otel.instrument(jvmMetrics,
"my.metric.jvm.vendor",
"my.mbean.jvm.vendor",
otel.&longValueCallback)
`
Expected Result
If run on a Termurin JDK it should report a my.metric.jvm.vendor value of 1
Actual Result
The logs show:
WARNING: Expected attribute my.mbean.jvm.vendor not found in mbean java.lang:type=Runtime
Component version
1.45.0
Log output
No response
Additional context
No response