|
@@ -32,6 +32,7 @@ import org.apache.hadoop.conf.Configured;
|
|
|
import org.apache.hadoop.fs.shell.Command;
|
|
|
import org.apache.hadoop.fs.shell.CommandFactory;
|
|
|
import org.apache.hadoop.fs.shell.FsCommand;
|
|
|
+import org.apache.hadoop.tracing.SpanReceiverHost;
|
|
|
import org.apache.hadoop.tools.TableListing;
|
|
|
import org.apache.hadoop.tracing.TraceUtils;
|
|
|
import org.apache.hadoop.util.Tool;
|
|
@@ -57,6 +58,9 @@ public class FsShell extends Configured implements Tool {
|
|
|
private final String usagePrefix =
|
|
|
"Usage: hadoop fs [generic options]";
|
|
|
|
|
|
+ private SpanReceiverHost spanReceiverHost;
|
|
|
+ static final String SEHLL_HTRACE_PREFIX = "dfs.shell.htrace.";
|
|
|
+
|
|
|
/**
|
|
|
* Default ctor with no configuration. Be sure to invoke
|
|
|
* {@link #setConf(Configuration)} with a valid configuration prior
|
|
@@ -97,6 +101,8 @@ public class FsShell extends Configured implements Tool {
|
|
|
commandFactory.addObject(new Usage(), "-usage");
|
|
|
registerCommands(commandFactory);
|
|
|
}
|
|
|
+ this.spanReceiverHost =
|
|
|
+ SpanReceiverHost.get(getConf(), SEHLL_HTRACE_PREFIX);
|
|
|
}
|
|
|
|
|
|
protected void registerCommands(CommandFactory factory) {
|
|
@@ -279,7 +285,7 @@ public class FsShell extends Configured implements Tool {
|
|
|
// initialize FsShell
|
|
|
init();
|
|
|
traceSampler = new SamplerBuilder(TraceUtils.
|
|
|
- wrapHadoopConf("dfs.shell.htrace.", getConf())).build();
|
|
|
+ wrapHadoopConf(SEHLL_HTRACE_PREFIX, getConf())).build();
|
|
|
int exitCode = -1;
|
|
|
if (argv.length < 1) {
|
|
|
printUsage(System.err);
|
|
@@ -335,6 +341,9 @@ public class FsShell extends Configured implements Tool {
|
|
|
fs.close();
|
|
|
fs = null;
|
|
|
}
|
|
|
+ if (this.spanReceiverHost != null) {
|
|
|
+ this.spanReceiverHost.closeReceivers();
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|