Skip to content

Commit b381cb4

Browse files
briaugenreichapurtell
authored andcommitted
HBASE-26745: Include balancer cost metrics in jmx endpoint (#4140)
Signed-off-by: Andrew Purtell <[email protected]>
1 parent 4858b25 commit b381cb4

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

hbase-http/src/main/java/org/apache/hadoop/hbase/util/JSONBean.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ private static void writeAttribute(JsonWriter writer, MBeanServer mBeanServer, O
255255
if ("modelerType".equals(attName)) {
256256
return;
257257
}
258-
if (attName.indexOf("=") >= 0 || attName.indexOf(":") >= 0 || attName.indexOf(" ") >= 0) {
258+
if (attName.indexOf("=") >= 0 || attName.indexOf(" ") >= 0) {
259259
return;
260260
}
261261

hbase-http/src/test/java/org/apache/hadoop/hbase/util/TestJSONBean.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ private MBeanServer getMockMBeanServer() throws Exception {
5959
MBeanInfo mbeanInfo = mock(MBeanInfo.class);
6060
when(mbeanInfo.getClassName()).thenReturn("testClassName");
6161
String[] attributeNames = new String[] {"intAttr", "nanAttr", "infinityAttr",
62-
"strAttr", "boolAttr"};
62+
"strAttr", "boolAttr", "test:Attr"};
6363
MBeanAttributeInfo[] attributeInfos = new MBeanAttributeInfo[attributeNames.length];
6464
for (int i = 0; i < attributeInfos.length; i++) {
6565
attributeInfos[i] = new MBeanAttributeInfo(attributeNames[i],
@@ -77,6 +77,7 @@ private MBeanServer getMockMBeanServer() throws Exception {
7777
thenReturn(Double.POSITIVE_INFINITY);
7878
when(mbeanServer.getAttribute(any(), eq("strAttr"))).thenReturn("aString");
7979
when(mbeanServer.getAttribute(any(), eq("boolAttr"))).thenReturn(true);
80+
when(mbeanServer.getAttribute(any(), eq("test:Attr"))).thenReturn("aString");
8081
return mbeanServer;
8182
}
8283

@@ -92,7 +93,8 @@ private String getExpectedJSON() {
9293
pw.println(" \"nanAttr\": \"NaN\",");
9394
pw.println(" \"infinityAttr\": \"Infinity\",");
9495
pw.println(" \"strAttr\": \"aString\",");
95-
pw.println(" \"boolAttr\": true");
96+
pw.println(" \"boolAttr\": true,");
97+
pw.println(" \"test:Attr\": aString");
9698
pw.println(" }");
9799
pw.println(" ]");
98100
pw.print("}");

0 commit comments

Comments
 (0)