diff --git a/hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/ipc/MetricsHBaseServerSourceFactory.java b/hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/ipc/MetricsHBaseServerSourceFactory.java index 4ad9f335a27..d6b13924dca 100644 --- a/hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/ipc/MetricsHBaseServerSourceFactory.java +++ b/hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/ipc/MetricsHBaseServerSourceFactory.java @@ -47,9 +47,9 @@ public abstract class MetricsHBaseServerSourceFactory { * @return The Camel Cased context name. */ protected static String createContextName(String serverName) { - if (serverName.contains("HMaster")) { + if (serverName.contains("HMaster") || serverName.contains("master")) { return "Master"; - } else if (serverName.contains("HRegion")) { + } else if (serverName.contains("HRegion") || serverName.contains("regionserver")) { return "RegionServer"; } return "IPC"; diff --git a/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/ipc/MetricsHBaseServerSourceFactoryImpl.java b/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/ipc/MetricsHBaseServerSourceFactoryImpl.java index df40e682c02..cca53e0b729 100644 --- a/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/ipc/MetricsHBaseServerSourceFactoryImpl.java +++ b/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/ipc/MetricsHBaseServerSourceFactoryImpl.java @@ -46,7 +46,7 @@ public class MetricsHBaseServerSourceFactoryImpl extends MetricsHBaseServerSourc if (source == null) { //Create the source. source = new MetricsHBaseServerSourceImpl( - METRICS_NAME, + context, METRICS_DESCRIPTION, context.toLowerCase(), context + METRICS_JMX_CONTEXT_SUFFIX, wrapper); diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/ipc/TestRpcMetrics.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/ipc/TestRpcMetrics.java index af764f45e11..443ec781ba3 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/ipc/TestRpcMetrics.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/ipc/TestRpcMetrics.java @@ -48,8 +48,8 @@ public class TestRpcMetrics { assertEquals("Master,sub=IPC", masterSource.getMetricsJmxContext()); assertEquals("RegionServer,sub=IPC", rsSource.getMetricsJmxContext()); - assertEquals("IPC", masterSource.getMetricsName()); - assertEquals("IPC", rsSource.getMetricsName()); + assertEquals("Master", masterSource.getMetricsName()); + assertEquals("RegionServer", rsSource.getMetricsName()); } /**