-
Type:
Improvement
-
Status: Resolved
-
Priority:
Normal
-
Resolution: Done
-
Affects Version/s: None
-
Fix Version/s: None
-
Component/s: None
-
Labels:
-
Template:customfield_10700 152199
-
Team:Systems Engineering
-
Story Points:2
-
Sprint:SE 2016-11-16, SE 2016-11-30, SE 2017-01-11
JMX supports retrieving several MBeans at once using globbing:
https://docs.oracle.com/javase/8/docs/api/javax/management/ObjectName.html
This would be especially useful for Puppet Server, which tracks metrics on a per-node basis:
metrics/v1/mbeans/*.compiler.compile.*.<some slow node>*
|
Currently, one would have to hit the root metrics/v1/mbeans endpoint, pipe the results to a script that greps out the relevant mbeans and then pipe those results to a script that forms a compound request.
It would also be nice to return only a specific attribute from a MBean. For example, querying the GarbageCollector MBean returns a lot of data:
# curl -k 'https://127.0.0.1:8140/metrics/v1/mbeans/java.lang:type=GarbageCollector,name=PS+Scavenge'|python -m json.tool
|
% Total % Received % Xferd Average Speed Time Time Time Current
|
Dload Upload Total Spent Left Speed
|
100 1723 100 1723 0 0 19571 0 --:--:-- --:--:-- --:--:-- 19804
|
{
|
"CollectionCount": 167,
|
"CollectionTime": 2053,
|
"LastGcInfo": {
|
"GcThreadCount": 2,
|
"duration": 6,
|
"endTime": 2036911,
|
"id": 167,
|
"memoryUsageAfterGc": {
|
"Code Cache": {
|
"key": "Code Cache",
|
"value": {
|
"committed": 41943040,
|
"init": 2555904,
|
"max": 251658240,
|
"used": 41526656
|
}
|
},
|
"Compressed Class Space": {
|
"key": "Compressed Class Space",
|
"value": {
|
"committed": 55296000,
|
"init": 0,
|
"max": 1073741824,
|
"used": 26451312
|
}
|
},
|
"Metaspace": {
|
"key": "Metaspace",
|
"value": {
|
"committed": 185057280,
|
"init": 0,
|
"max": -1,
|
"used": 111937088
|
}
|
},
|
"PS Eden Space": {
|
"key": "PS Eden Space",
|
"value": {
|
"committed": 51380224,
|
"init": 34078720,
|
"max": 55574528,
|
"used": 0
|
}
|
},
|
"PS Old Gen": {
|
"key": "PS Old Gen",
|
"value": {
|
"committed": 179306496,
|
"init": 89653248,
|
"max": 179306496,
|
"used": 149947456
|
}
|
},
|
"PS Survivor Space": {
|
"key": "PS Survivor Space",
|
"value": {
|
"committed": 17301504,
|
"init": 5242880,
|
"max": 17301504,
|
"used": 1738920
|
}
|
}
|
},
|
"memoryUsageBeforeGc": {
|
"Code Cache": {
|
"key": "Code Cache",
|
"value": {
|
"committed": 41943040,
|
"init": 2555904,
|
"max": 251658240,
|
"used": 41526656
|
}
|
},
|
"Compressed Class Space": {
|
"key": "Compressed Class Space",
|
"value": {
|
"committed": 55296000,
|
"init": 0,
|
"max": 1073741824,
|
"used": 26451312
|
}
|
},
|
"Metaspace": {
|
"key": "Metaspace",
|
"value": {
|
"committed": 185057280,
|
"init": 0,
|
"max": -1,
|
"used": 111937088
|
}
|
},
|
"PS Eden Space": {
|
"key": "PS Eden Space",
|
"value": {
|
"committed": 51380224,
|
"init": 34078720,
|
"max": 55574528,
|
"used": 51380224
|
}
|
},
|
"PS Old Gen": {
|
"key": "PS Old Gen",
|
"value": {
|
"committed": 179306496,
|
"init": 89653248,
|
"max": 179306496,
|
"used": 149947456
|
}
|
},
|
"PS Survivor Space": {
|
"key": "PS Survivor Space",
|
"value": {
|
"committed": 16252928,
|
"init": 5242880,
|
"max": 16252928,
|
"used": 1474336
|
}
|
}
|
},
|
"startTime": 2036905
|
},
|
"MemoryPoolNames": "[Ljava.lang.String;@29028c4b",
|
"Name": "PS Scavenge",
|
"ObjectName": "java.lang:type=GarbageCollector,name=PS Scavenge",
|
"Valid": true
|
}
|
It would be great to pull out a single attribute, such as the CollectionCount.