hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cmcc...@apache.org
Subject git commit: HDFS-7223. Tracing span description of IPC client is too long (iwasakims via cmccabe)
Date Fri, 24 Oct 2014 02:14:56 GMT
Repository: hadoop
Updated Branches:
  refs/heads/trunk db45f047a -> 5b56ac4c7


HDFS-7223. Tracing span description of IPC client is too long (iwasakims via cmccabe)


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/5b56ac4c
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/5b56ac4c
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/5b56ac4c

Branch: refs/heads/trunk
Commit: 5b56ac4c72d69d1b3d6feec9d96c9d62eb02d28c
Parents: db45f04
Author: Colin Patrick Mccabe <cmccabe@cloudera.com>
Authored: Thu Oct 23 19:14:00 2014 -0700
Committer: Colin Patrick Mccabe <cmccabe@cloudera.com>
Committed: Thu Oct 23 19:14:00 2014 -0700

----------------------------------------------------------------------
 .../apache/hadoop/ipc/ProtobufRpcEngine.java    |  4 +---
 .../org/apache/hadoop/ipc/RpcClientUtil.java    | 21 ++++++++++++++++++++
 .../apache/hadoop/ipc/WritableRpcEngine.java    |  4 +---
 hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt     |  3 +++
 .../org/apache/hadoop/tracing/TestTracing.java  | 10 +++++-----
 5 files changed, 31 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/5b56ac4c/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/ProtobufRpcEngine.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/ProtobufRpcEngine.java
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/ProtobufRpcEngine.java
index 124d835..ddda55c 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/ProtobufRpcEngine.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/ProtobufRpcEngine.java
@@ -212,9 +212,7 @@ public class ProtobufRpcEngine implements RpcEngine {
       // 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);

http://git-wip-us.apache.org/repos/asf/hadoop/blob/5b56ac4c/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/RpcClientUtil.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/RpcClientUtil.java
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/RpcClientUtil.java
index 2623f9e..d9bd71b 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/RpcClientUtil.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/RpcClientUtil.java
@@ -189,4 +189,25 @@ public class RpcClientUtil {
         .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();
+  }
 }

http://git-wip-us.apache.org/repos/asf/hadoop/blob/5b56ac4c/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/WritableRpcEngine.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/WritableRpcEngine.java
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/WritableRpcEngine.java
index c2d9435..94a6b1d 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/WritableRpcEngine.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/WritableRpcEngine.java
@@ -235,9 +235,7 @@ public class WritableRpcEngine implements RpcEngine {
       }
       TraceScope traceScope = null;
       if (Trace.isTracing()) {
-        traceScope = Trace.startSpan(
-            method.getDeclaringClass().getCanonicalName() +
-            "." + method.getName());
+        traceScope = Trace.startSpan(RpcClientUtil.methodToTraceString(method));
       }
       ObjectWritable value;
       try {

http://git-wip-us.apache.org/repos/asf/hadoop/blob/5b56ac4c/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
index d3da6d8..28bfea6 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
+++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
@@ -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

http://git-wip-us.apache.org/repos/asf/hadoop/blob/5b56ac4c/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/tracing/TestTracing.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/tracing/TestTracing.java
b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/tracing/TestTracing.java
index 5c24500..0f96c6f 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/tracing/TestTracing.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/tracing/TestTracing.java
@@ -83,15 +83,15 @@ public class TestTracing {
     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 class TestTracing {
     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);


Mime
View raw message