HBASE-26745: Include balancer cost metrics in jmx endpoint (#4140)

Signed-off-by: Andrew Purtell <apurtell@apache.org>
This commit is contained in:
Bri Augenreich 2022-03-02 20:38:05 -05:00 committed by Andrew Purtell
parent 36e1a1d260
commit 067c28e9ae
2 changed files with 5 additions and 3 deletions

View File

@ -255,7 +255,7 @@ public class JSONBean {
if ("modelerType".equals(attName)) { if ("modelerType".equals(attName)) {
return; return;
} }
if (attName.indexOf("=") >= 0 || attName.indexOf(":") >= 0 || attName.indexOf(" ") >= 0) { if (attName.indexOf("=") >= 0 || attName.indexOf(" ") >= 0) {
return; return;
} }

View File

@ -59,7 +59,7 @@ public class TestJSONBean {
MBeanInfo mbeanInfo = mock(MBeanInfo.class); MBeanInfo mbeanInfo = mock(MBeanInfo.class);
when(mbeanInfo.getClassName()).thenReturn("testClassName"); when(mbeanInfo.getClassName()).thenReturn("testClassName");
String[] attributeNames = new String[] {"intAttr", "nanAttr", "infinityAttr", String[] attributeNames = new String[] {"intAttr", "nanAttr", "infinityAttr",
"strAttr", "boolAttr"}; "strAttr", "boolAttr", "test:Attr"};
MBeanAttributeInfo[] attributeInfos = new MBeanAttributeInfo[attributeNames.length]; MBeanAttributeInfo[] attributeInfos = new MBeanAttributeInfo[attributeNames.length];
for (int i = 0; i < attributeInfos.length; i++) { for (int i = 0; i < attributeInfos.length; i++) {
attributeInfos[i] = new MBeanAttributeInfo(attributeNames[i], attributeInfos[i] = new MBeanAttributeInfo(attributeNames[i],
@ -77,6 +77,7 @@ public class TestJSONBean {
thenReturn(Double.POSITIVE_INFINITY); thenReturn(Double.POSITIVE_INFINITY);
when(mbeanServer.getAttribute(any(), eq("strAttr"))).thenReturn("aString"); when(mbeanServer.getAttribute(any(), eq("strAttr"))).thenReturn("aString");
when(mbeanServer.getAttribute(any(), eq("boolAttr"))).thenReturn(true); when(mbeanServer.getAttribute(any(), eq("boolAttr"))).thenReturn(true);
when(mbeanServer.getAttribute(any(), eq("test:Attr"))).thenReturn("aString");
return mbeanServer; return mbeanServer;
} }
@ -92,7 +93,8 @@ public class TestJSONBean {
pw.println(" \"nanAttr\": \"NaN\","); pw.println(" \"nanAttr\": \"NaN\",");
pw.println(" \"infinityAttr\": \"Infinity\","); pw.println(" \"infinityAttr\": \"Infinity\",");
pw.println(" \"strAttr\": \"aString\","); pw.println(" \"strAttr\": \"aString\",");
pw.println(" \"boolAttr\": true"); pw.println(" \"boolAttr\": true,");
pw.println(" \"test:Attr\": aString");
pw.println(" }"); pw.println(" }");
pw.println(" ]"); pw.println(" ]");
pw.print("}"); pw.print("}");