HADOOP-12124. Add HTrace support for FsShell (cmccabe)
This commit is contained in:
parent
68e588cbee
commit
ad60807238
@ -671,6 +671,8 @@ Release 2.8.0 - UNRELEASED
|
|||||||
TestCryptoStreamsWithOpensslAesCtrCryptoCodec when OpenSSL is not
|
TestCryptoStreamsWithOpensslAesCtrCryptoCodec when OpenSSL is not
|
||||||
installed. (wang)
|
installed. (wang)
|
||||||
|
|
||||||
|
HADOOP-12124. Add HTrace support for FsShell (cmccabe)
|
||||||
|
|
||||||
OPTIMIZATIONS
|
OPTIMIZATIONS
|
||||||
|
|
||||||
HADOOP-11785. Reduce the number of listStatus operation in distcp
|
HADOOP-11785. Reduce the number of listStatus operation in distcp
|
||||||
|
@ -33,8 +33,13 @@
|
|||||||
import org.apache.hadoop.fs.shell.CommandFactory;
|
import org.apache.hadoop.fs.shell.CommandFactory;
|
||||||
import org.apache.hadoop.fs.shell.FsCommand;
|
import org.apache.hadoop.fs.shell.FsCommand;
|
||||||
import org.apache.hadoop.tools.TableListing;
|
import org.apache.hadoop.tools.TableListing;
|
||||||
|
import org.apache.hadoop.tracing.TraceUtils;
|
||||||
import org.apache.hadoop.util.Tool;
|
import org.apache.hadoop.util.Tool;
|
||||||
import org.apache.hadoop.util.ToolRunner;
|
import org.apache.hadoop.util.ToolRunner;
|
||||||
|
import org.apache.htrace.Sampler;
|
||||||
|
import org.apache.htrace.SamplerBuilder;
|
||||||
|
import org.apache.htrace.Trace;
|
||||||
|
import org.apache.htrace.TraceScope;
|
||||||
|
|
||||||
/** Provide command line access to a FileSystem. */
|
/** Provide command line access to a FileSystem. */
|
||||||
@InterfaceAudience.Private
|
@InterfaceAudience.Private
|
||||||
@ -47,6 +52,7 @@ public class FsShell extends Configured implements Tool {
|
|||||||
private FileSystem fs;
|
private FileSystem fs;
|
||||||
private Trash trash;
|
private Trash trash;
|
||||||
protected CommandFactory commandFactory;
|
protected CommandFactory commandFactory;
|
||||||
|
private Sampler traceSampler;
|
||||||
|
|
||||||
private final String usagePrefix =
|
private final String usagePrefix =
|
||||||
"Usage: hadoop fs [generic options]";
|
"Usage: hadoop fs [generic options]";
|
||||||
@ -272,7 +278,8 @@ private TableListing createOptionTableListing() {
|
|||||||
public int run(String argv[]) throws Exception {
|
public int run(String argv[]) throws Exception {
|
||||||
// initialize FsShell
|
// initialize FsShell
|
||||||
init();
|
init();
|
||||||
|
traceSampler = new SamplerBuilder(TraceUtils.
|
||||||
|
wrapHadoopConf("dfs.shell.htrace.", getConf())).build();
|
||||||
int exitCode = -1;
|
int exitCode = -1;
|
||||||
if (argv.length < 1) {
|
if (argv.length < 1) {
|
||||||
printUsage(System.err);
|
printUsage(System.err);
|
||||||
@ -284,7 +291,12 @@ public int run(String argv[]) throws Exception {
|
|||||||
if (instance == null) {
|
if (instance == null) {
|
||||||
throw new UnknownCommandException();
|
throw new UnknownCommandException();
|
||||||
}
|
}
|
||||||
exitCode = instance.run(Arrays.copyOfRange(argv, 1, argv.length));
|
TraceScope scope = Trace.startSpan(instance.getCommandName(), traceSampler);
|
||||||
|
try {
|
||||||
|
exitCode = instance.run(Arrays.copyOfRange(argv, 1, argv.length));
|
||||||
|
} finally {
|
||||||
|
scope.close();
|
||||||
|
}
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
displayError(cmd, e.getLocalizedMessage());
|
displayError(cmd, e.getLocalizedMessage());
|
||||||
if (instance != null) {
|
if (instance != null) {
|
||||||
|
Loading…
Reference in New Issue
Block a user