HBASE-12328 Need to separate JvmMetrics for Master and RegionServer (Sanghyun Yun)
This commit is contained in:
parent
b389ca211e
commit
31c185aad5
|
@ -47,9 +47,9 @@ public abstract class MetricsHBaseServerSourceFactory {
|
||||||
* @return The Camel Cased context name.
|
* @return The Camel Cased context name.
|
||||||
*/
|
*/
|
||||||
protected static String createContextName(String serverName) {
|
protected static String createContextName(String serverName) {
|
||||||
if (serverName.contains("HMaster")) {
|
if (serverName.contains("HMaster") || serverName.contains("master")) {
|
||||||
return "Master";
|
return "Master";
|
||||||
} else if (serverName.contains("HRegion")) {
|
} else if (serverName.contains("HRegion") || serverName.contains("regionserver")) {
|
||||||
return "RegionServer";
|
return "RegionServer";
|
||||||
}
|
}
|
||||||
return "IPC";
|
return "IPC";
|
||||||
|
|
|
@ -46,7 +46,7 @@ public class MetricsHBaseServerSourceFactoryImpl extends MetricsHBaseServerSourc
|
||||||
if (source == null) {
|
if (source == null) {
|
||||||
//Create the source.
|
//Create the source.
|
||||||
source = new MetricsHBaseServerSourceImpl(
|
source = new MetricsHBaseServerSourceImpl(
|
||||||
METRICS_NAME,
|
context,
|
||||||
METRICS_DESCRIPTION,
|
METRICS_DESCRIPTION,
|
||||||
context.toLowerCase(),
|
context.toLowerCase(),
|
||||||
context + METRICS_JMX_CONTEXT_SUFFIX, wrapper);
|
context + METRICS_JMX_CONTEXT_SUFFIX, wrapper);
|
||||||
|
|
|
@ -48,8 +48,8 @@ public class TestRpcMetrics {
|
||||||
assertEquals("Master,sub=IPC", masterSource.getMetricsJmxContext());
|
assertEquals("Master,sub=IPC", masterSource.getMetricsJmxContext());
|
||||||
assertEquals("RegionServer,sub=IPC", rsSource.getMetricsJmxContext());
|
assertEquals("RegionServer,sub=IPC", rsSource.getMetricsJmxContext());
|
||||||
|
|
||||||
assertEquals("IPC", masterSource.getMetricsName());
|
assertEquals("Master", masterSource.getMetricsName());
|
||||||
assertEquals("IPC", rsSource.getMetricsName());
|
assertEquals("RegionServer", rsSource.getMetricsName());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue