hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cmcc...@apache.org
Subject hadoop git commit: HADOOP-12201. Add tracing to FileSystem#createFileSystem and Globber#glob (cmccabe)
Date Thu, 09 Jul 2015 03:12:19 GMT
Repository: hadoop
Updated Branches:
  refs/heads/branch-2 4227fff3c -> 016d661ca


HADOOP-12201. Add tracing to FileSystem#createFileSystem and Globber#glob (cmccabe)

(cherry picked from commit b8832fcf1e2ae1e43d5e4523016731af40ab58d7)


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

Branch: refs/heads/branch-2
Commit: 016d661cafbeaead2eeb2a03c05a561f4dde91a7
Parents: 4227fff
Author: Colin Patrick Mccabe <cmccabe@cloudera.com>
Authored: Wed Jul 8 20:07:21 2015 -0700
Committer: Colin Patrick Mccabe <cmccabe@cloudera.com>
Committed: Wed Jul 8 20:12:11 2015 -0700

----------------------------------------------------------------------
 hadoop-common-project/hadoop-common/CHANGES.txt |  3 +++
 .../java/org/apache/hadoop/fs/FileSystem.java   | 20 ++++++++++++++++----
 .../main/java/org/apache/hadoop/fs/Globber.java | 17 +++++++++++++++++
 3 files changed, 36 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/016d661c/hadoop-common-project/hadoop-common/CHANGES.txt
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt
index 5695074..6bb0c08 100644
--- a/hadoop-common-project/hadoop-common/CHANGES.txt
+++ b/hadoop-common-project/hadoop-common/CHANGES.txt
@@ -186,6 +186,9 @@ Release 2.8.0 - UNRELEASED
     HADOOP-12195. Add annotation to package-info.java file to workaround
     MCOMPILER-205. (wang)
 
+    HADOOP-12201. Add tracing to FileSystem#createFileSystem and Globber#glob
+    (cmccabe)
+
   OPTIMIZATIONS
 
     HADOOP-11785. Reduce the number of listStatus operation in distcp

http://git-wip-us.apache.org/repos/asf/hadoop/blob/016d661c/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileSystem.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileSystem.java
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileSystem.java
index 800d132..3a589de 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileSystem.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileSystem.java
@@ -67,6 +67,9 @@ import org.apache.hadoop.util.Progressable;
 import org.apache.hadoop.util.ReflectionUtils;
 import org.apache.hadoop.util.ShutdownHookManager;
 import org.apache.hadoop.util.StringUtils;
+import org.apache.htrace.Span;
+import org.apache.htrace.Trace;
+import org.apache.htrace.TraceScope;
 
 import com.google.common.annotations.VisibleForTesting;
 
@@ -2676,10 +2679,19 @@ public abstract class FileSystem extends Configured implements Closeable
{
 
   private static FileSystem createFileSystem(URI uri, Configuration conf
       ) throws IOException {
-    Class<?> clazz = getFileSystemClass(uri.getScheme(), conf);
-    FileSystem fs = (FileSystem)ReflectionUtils.newInstance(clazz, conf);
-    fs.initialize(uri, conf);
-    return fs;
+    TraceScope scope = Trace.startSpan("FileSystem#createFileSystem");
+    Span span = scope.getSpan();
+    if (span != null) {
+      span.addKVAnnotation("scheme", uri.getScheme());
+    }
+    try {
+      Class<?> clazz = getFileSystemClass(uri.getScheme(), conf);
+      FileSystem fs = (FileSystem)ReflectionUtils.newInstance(clazz, conf);
+      fs.initialize(uri, conf);
+      return fs;
+    } finally {
+      scope.close();
+    }
   }
 
   /** Caching FileSystem objects */

http://git-wip-us.apache.org/repos/asf/hadoop/blob/016d661c/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/Globber.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/Globber.java
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/Globber.java
index 9cb810f..48639b4 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/Globber.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/Globber.java
@@ -28,6 +28,10 @@ import org.apache.commons.logging.Log;
 import org.apache.hadoop.classification.InterfaceAudience;
 import org.apache.hadoop.classification.InterfaceStability;
 
+import org.apache.htrace.Span;
+import org.apache.htrace.Trace;
+import org.apache.htrace.TraceScope;
+
 @InterfaceAudience.Private
 @InterfaceStability.Unstable
 class Globber {
@@ -136,6 +140,19 @@ class Globber {
   }
 
   public FileStatus[] glob() throws IOException {
+    TraceScope scope = Trace.startSpan("Globber#glob");
+    Span span = scope.getSpan();
+    if (span != null) {
+      span.addKVAnnotation("pattern", pathPattern.toUri().getPath());
+    }
+    try {
+      return doGlob();
+    } finally {
+      scope.close();
+    }
+  }
+
+  private FileStatus[] doGlob() throws IOException {
     // First we get the scheme and authority of the pattern that was passed
     // in.
     String scheme = schemeFromPath(pathPattern);


Mime
View raw message