metrics
metrics copied to clipboard
Add the ability to set a prefix on a metricSet
I am using metrics in a project that works as a plugin to a large one...when we use the JVM metrics the big issue is that each metricset doesnt prefix itself in anyway ie
MetricSet jvm = new JvmAttributeGaugeSet();
MetricSet memory = new MemoryUsageGaugeSet();
MetricSet threads = new CachedThreadStatesGaugeSet(10,TimeUnit.SECONDS);
MetricSet gc = new GarbageCollectorMetricSet();
MetricSet cloader = new ClassLoadingGaugeSet();
registry.registerAll(jvm);
registry.registerAll(memory);
registry.registerAll(threads);
registry.registerAll(gc);
registry.registerAll(cloader);
this is not reported in an effective manner because the metric names are poorly defined ie
14:56:55 [ staff]: count : 70
14:56:55 [ staff]: daemon.count : 28
14:56:55 [ staff]: deadlock.count : 0
14:56:55 [ staff]: deadlocks : []
14:56:55 [ staff]: heap.committed : 2147483648
14:56:55 [ staff]: heap.init : 2147483648
14:56:55 [ staff]: heap.max : 8388608000
14:56:55 [ staff]: heap.usage : 0.1875861053466797
14:56:55 [ staff]: heap.used : 1573586304
14:56:55 [ staff]: loaded : 22482
14:56:55 [ staff]: name : [email protected]
14:56:55 [ staff]: new.count : 0
14:56:55 [ staff]: non-heap.committed : 218841088
14:56:55 [ staff]: non-heap.init : 2555904
14:56:55 [ staff]: non-heap.max : -1
14:56:55 [ staff]: non-heap.usage : -2.0750604E8
14:56:55 [ staff]: non-heap.used : 207506040
14:56:55 [ staff]: pools.Code-Cache.committed : 59047936
14:56:55 [ staff]: pools.Code-Cache.init : 2555904
14:56:55 [ staff]: pools.Code-Cache.max : 251658240
14:56:55 [ staff]: pools.Code-Cache.usage : 0.23294754028320314
14:56:55 [ staff]: pools.Code-Cache.used : 58623168
14:56:55 [ staff]: pools.Compressed-Class-Space.committed : 19472384
14:56:55 [ staff]: pools.Compressed-Class-Space.init : 0
14:56:55 [ staff]: pools.Compressed-Class-Space.max : 1073741824
14:56:55 [ staff]: pools.Compressed-Class-Space.usage : 0.015889562666416168
14:56:55 [ staff]: pools.Compressed-Class-Space.used : 17061288
14:56:55 [ staff]: pools.G1-Eden-Space.committed : 1319108608
14:56:55 [ staff]: pools.G1-Eden-Space.init : 113246208
14:56:55 [ staff]: pools.G1-Eden-Space.max : -1
14:56:55 [ staff]: pools.G1-Eden-Space.usage : 0.6868044515103339
14:56:55 [ staff]: pools.G1-Eden-Space.used : 905969664
14:56:55 [ staff]: pools.G1-Eden-Space.used-after-gc : 0
14:56:55 [ staff]: pools.G1-Old-Gen.committed : 813694976
14:56:55 [ staff]: pools.G1-Old-Gen.init : 2034237440
14:56:55 [ staff]: pools.G1-Old-Gen.max : 8388608000
14:56:55 [ staff]: pools.G1-Old-Gen.usage : 0.07783610534667969
14:56:55 [ staff]: pools.G1-Old-Gen.used : 652936576
14:56:55 [ staff]: pools.G1-Old-Gen.used-after-gc : 559018248
14:56:55 [ staff]: pools.G1-Survivor-Space.committed : 14680064
14:56:55 [ staff]: pools.G1-Survivor-Space.init : 0
14:56:55 [ staff]: pools.G1-Survivor-Space.max : -1
14:56:55 [ staff]: pools.G1-Survivor-Space.usage : 1.0
14:56:55 [ staff]: pools.G1-Survivor-Space.used : 14680064
14:56:55 [ staff]: pools.G1-Survivor-Space.used-after-gc : 14680064
14:56:55 [ staff]: pools.Metaspace.committed : 140320768
14:56:55 [ staff]: pools.Metaspace.init : 0
14:56:55 [ staff]: pools.Metaspace.max : -1
14:56:55 [ staff]: pools.Metaspace.usage : 0.9394590542719948
14:56:55 [ staff]: pools.Metaspace.used : 131825616
14:56:55 [ staff]: runnable.count : 16
14:56:55 [ staff]: terminated.count : 0
14:56:55 [ staff]: timed_waiting.count : 32
14:56:55 [ staff]: total.committed : 2366324736
14:56:55 [ staff]: total.init : 2150039552
14:56:55 [ staff]: total.max : 8388607999
14:56:55 [ staff]: total.used : 1781107288
14:56:55 [ staff]: unloaded : 0
14:56:55 [ staff]: uptime : 9725780
14:56:55 [ staff]: vendor : Oracle Corporation Java HotSpot(TM) 64-Bit Server VM 25.161-b12 (1.8)
14:56:55 [ staff]: waiting.count : 22
The above was a metrics dump
the metricsets would be better if the internal metric names used "
instead of terminated.count use 'Thread.terminated.count`
The alternative is opening the
registery.registerAll(String prefix,MetricSet set) to be public rather than private
I would like to work on this issue.