HADOOP-18364. All method metrics related to the RPC protocol should be initialized. (#4624). Contributed by Shuyan Zhang.
Reviewed-by: Erik Krogen <xkrogen@apache.org> Reviewed-by: Chao Sun <sunchao@apache.org> Signed-off-by: He Xiaoqiao <hexiaoqiao@apache.org>
This commit is contained in:
parent
8eebf40b1a
commit
dbf73e16b1
@ -72,7 +72,7 @@ public void init(Class<?> protocol) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
protocolCache.add(protocol);
|
protocolCache.add(protocol);
|
||||||
for (Method method : protocol.getDeclaredMethods()) {
|
for (Method method : protocol.getMethods()) {
|
||||||
String name = method.getName();
|
String name = method.getName();
|
||||||
LOG.debug(name);
|
LOG.debug(name);
|
||||||
addMetricIfNotExists(name);
|
addMetricIfNotExists(name);
|
||||||
|
@ -48,6 +48,9 @@
|
|||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
|
import org.apache.hadoop.hdfs.server.namenode.NameNodeRpcServer;
|
||||||
|
import org.apache.hadoop.ipc.metrics.RpcDetailedMetrics;
|
||||||
import org.apache.hadoop.thirdparty.com.google.common.collect.ImmutableList;
|
import org.apache.hadoop.thirdparty.com.google.common.collect.ImmutableList;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
@ -1128,4 +1131,14 @@ public void testEditLogTailing() throws Exception {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testNNRPCMetricIntegrity() {
|
||||||
|
RpcDetailedMetrics metrics =
|
||||||
|
((NameNodeRpcServer) cluster.getNameNode()
|
||||||
|
.getRpcServer()).getClientRpcServer().getRpcDetailedMetrics();
|
||||||
|
MetricsRecordBuilder rb = getMetrics(metrics.name());
|
||||||
|
// CommitBlockSynchronizationNumOps should exist.
|
||||||
|
assertCounter("CommitBlockSynchronizationNumOps", 0L, rb);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user