I'm having trouble with what seems to result from non-deterministic metric key generation occurring when using JMX export.
Prior to upgrading our JVM version I'm receiving two metrics (ParNew and ConcurrentMarkSweep) under the following key:
java_lang_GarbageCollector_CollectionCount
Whereas after switching to a newer JVM version Prometheus generates two distinct metrics:
java_lang_G1_Young_Generation_CollectionCount
java_lang_G1_Old_Generation_CollectionCount
Any ideas what's causing this and how can I make key generation deterministic?
Below is an extract of what jmx_exporter outputs when I do a manual scraping.
It looks like JMX bean property order affects metric key naming.
jmx_exporter % grep CollectionCount scrape1.txt
java.lang{type=GarbageCollector, name=ParNew}[]CollectionCount: 10659
java.lang{type=GarbageCollector, name=ConcurrentMarkSweep}[]CollectionCount: 24
In Prometheus this results in java_lang_GarbageCollector_CollectionCount
% grep CollectionCount scrape2.txt
java.lang{name=G1 Young Generation, type=GarbageCollector}[]CollectionCount: 811
java.lang{name=G1 Old Generation, type=GarbageCollector}[]CollectionCount: 0