jmx_exporter icon indicating copy to clipboard operation
jmx_exporter copied to clipboard

Add basic support for arrays

Open zeeke opened this issue 6 years ago • 5 comments

I'm trying to configure an exporter for ActiveMQ and I thinks some array attributes can be useful as exported metric:

The attributes I'm interested on are:

  • org.apache.activemq:type=Broker,brokerName=XXX.Topics
  • org.apache.activemq:type=Broker,brokerName=XXX.Queues
  • org.apache.activemq:type=Broker,brokerName=XXX,destinationType=Queue,destinationName=YYY.Subscriptions

and the object type is (as reported by VisualVM): javax.management.ObjectName[205]

These object aren't supported by the exporter, as stated in: https://github.com/prometheus/jmx_exporter/blob/master/collector/src/main/java/io/prometheus/jmx/JmxScraper.java#L273

Please think if a simple array length can be extracted as a metric for this kind of objects. If there aren't any better plan to manage arrays, it's better than nothing.

I can work on a PR if needed.

zeeke avatar Apr 15 '19 08:04 zeeke

I'd like to see a few other uses rather than supporting the first use case we come across.

brian-brazil avatar Nov 14 '19 13:11 brian-brazil

I will add one more case. We are using jmx+zabbix to monitor complex java metrics. Some zabbix triggers involved value of -XX:MinMetaspaceExpansion/ -XX:MaxMetaspaceExpansion.

For example we have such metaspace trigger

Name: No memory for next Metaspace expansion Expression: Usage.committed >= Usage.max - MinMetaspaceExpansion

Values of MinMetaspaceExpansion/MaxMetaspaceExpansion are accessible by jmx only in mbea "java.lang.Runtime InputArguments" which is array, currently not supported by jmx_exporter. So for now we are using custom zabbix item which retrieve their values from java process arguments, which is way more hacky

MalKeshar avatar Oct 07 '21 14:10 MalKeshar

I'd really appreciate array support as well. I've configured JMX exporter for scraping Debezium MySQL Connector JMX metrics.

Specifically I'm interested in the following attribute: debezium.mysql:type=connector-metrics,context=streaming,server=<mysql.server.name>.CapturedTables which is of String[] type. You can its description here

AFAIU it's currently unsupported: https://github.com/prometheus/jmx_exporter/blob/master/collector/src/main/java/io/prometheus/jmx/JmxScraper.java#L284

Could be really useful :)

rotem-ad avatar Oct 26 '21 16:10 rotem-ad

I'm also using Debezium but for me a really useful metric would be to calculate the progress % of the snapshot

Debezium exposes the current PK ids being snapshoted, and the last PK ids to be snapshoted, but since a database table may have multiple columns in a PK, the JMX value is an array of Ids, so unfortunately not exported to prometheus

Thiago-Dantas avatar Nov 10 '21 14:11 Thiago-Dantas

@zeeke I'm sure you have moved on from this issue, given it it's over 4 years old, but had some questions.

Looking at the ActiveMQ MBean reference (https://activemq.apache.org/jmx.html) it appears that some of the attributes should be simple numerics.

Are these being exported?

dhoard avatar Jul 27 '23 11:07 dhoard