HDFS-7223. Tracing span description of IPC client is too long (iwasakims via cmccabe)
This commit is contained in:
parent
db45f047ab
commit
5b56ac4c72
@ -212,9 +212,7 @@ public Object invoke(Object proxy, Method method, Object[] args)
|
||||
// guard it in the if statement to make sure there isn't
|
||||
// any extra string manipulation.
|
||||
if (Trace.isTracing()) {
|
||||
traceScope = Trace.startSpan(
|
||||
method.getDeclaringClass().getCanonicalName() +
|
||||
"." + method.getName());
|
||||
traceScope = Trace.startSpan(RpcClientUtil.methodToTraceString(method));
|
||||
}
|
||||
|
||||
RequestHeaderProto rpcRequestHeader = constructRpcRequestHeader(method);
|
||||
|
@ -189,4 +189,25 @@ private static ProtocolMetaInfoPB getProtocolMetaInfoProxy(Object proxy,
|
||||
.getProtocolMetaInfoProxy(inv.getConnectionId(), conf,
|
||||
NetUtils.getDefaultSocketFactory(conf)).getProxy();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert an RPC method to a string.
|
||||
* The format we want is 'MethodOuterClassShortName#methodName'.
|
||||
*
|
||||
* For example, if the method is:
|
||||
* org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos.
|
||||
* ClientNamenodeProtocol.BlockingInterface.getServerDefaults
|
||||
*
|
||||
* the format we want is:
|
||||
* ClientNamenodeProtocol#getServerDefaults
|
||||
*/
|
||||
public static String methodToTraceString(Method method) {
|
||||
Class<?> clazz = method.getDeclaringClass();
|
||||
while (true) {
|
||||
Class<?> next = clazz.getEnclosingClass();
|
||||
if (next == null || next.getEnclosingClass() == null) break;
|
||||
clazz = next;
|
||||
}
|
||||
return clazz.getSimpleName() + "#" + method.getName();
|
||||
}
|
||||
}
|
||||
|
@ -235,9 +235,7 @@ public Object invoke(Object proxy, Method method, Object[] args)
|
||||
}
|
||||
TraceScope traceScope = null;
|
||||
if (Trace.isTracing()) {
|
||||
traceScope = Trace.startSpan(
|
||||
method.getDeclaringClass().getCanonicalName() +
|
||||
"." + method.getName());
|
||||
traceScope = Trace.startSpan(RpcClientUtil.methodToTraceString(method));
|
||||
}
|
||||
ObjectWritable value;
|
||||
try {
|
||||
|
@ -300,6 +300,9 @@ Release 2.7.0 - UNRELEASED
|
||||
HDFS-7257. Add the time of last HA state transition to NN's /jmx page.
|
||||
(Charles Lamb via wheat9)
|
||||
|
||||
HDFS-7223. Tracing span description of IPC client is too long (iwasakims
|
||||
via cmccabe)
|
||||
|
||||
OPTIMIZATIONS
|
||||
|
||||
BUG FIXES
|
||||
|
@ -83,15 +83,15 @@ public void testWriteTraceHooks() throws Exception {
|
||||
String[] expectedSpanNames = {
|
||||
"testWriteTraceHooks",
|
||||
"org.apache.hadoop.hdfs.protocol.ClientProtocol.create",
|
||||
"org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos.ClientNamenodeProtocol.BlockingInterface.create",
|
||||
"ClientNamenodeProtocol#create",
|
||||
"org.apache.hadoop.hdfs.protocol.ClientProtocol.fsync",
|
||||
"org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos.ClientNamenodeProtocol.BlockingInterface.fsync",
|
||||
"ClientNamenodeProtocol#fsync",
|
||||
"org.apache.hadoop.hdfs.protocol.ClientProtocol.complete",
|
||||
"org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos.ClientNamenodeProtocol.BlockingInterface.complete",
|
||||
"ClientNamenodeProtocol#complete",
|
||||
"DFSOutputStream",
|
||||
"OpWriteBlockProto",
|
||||
"org.apache.hadoop.hdfs.protocol.ClientProtocol.addBlock",
|
||||
"org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos.ClientNamenodeProtocol.BlockingInterface.addBlock"
|
||||
"ClientNamenodeProtocol#addBlock"
|
||||
};
|
||||
assertSpanNamesFound(expectedSpanNames);
|
||||
|
||||
@ -162,7 +162,7 @@ public void testReadTraceHooks() throws Exception {
|
||||
String[] expectedSpanNames = {
|
||||
"testReadTraceHooks",
|
||||
"org.apache.hadoop.hdfs.protocol.ClientProtocol.getBlockLocations",
|
||||
"org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos.ClientNamenodeProtocol.BlockingInterface.getBlockLocations",
|
||||
"ClientNamenodeProtocol#getBlockLocations",
|
||||
"OpReadBlockProto"
|
||||
};
|
||||
assertSpanNamesFound(expectedSpanNames);
|
||||
|
Loading…
Reference in New Issue
Block a user