HDFS-7202. Should be able to omit package name of SpanReceiver on "hadoop trace -add" (iwasakims via cmccabe)

(cherry picked from commit d996235285)
This commit is contained in:
Colin Patrick Mccabe 2014-10-08 17:55:46 -07:00
parent f27a88562e
commit f1feaae1dd
3 changed files with 15 additions and 4 deletions

View File

@ -137,10 +137,6 @@ public class SpanReceiverHost implements TraceAdminProtocol {
getUniqueLocalTraceFileName()); getUniqueLocalTraceFileName());
} }
for (String className : receiverNames) { for (String className : receiverNames) {
className = className.trim();
if (!className.contains(".")) {
className = "org.htrace.impl." + className;
}
try { try {
SpanReceiver rcvr = loadInstance(className, EMPTY); SpanReceiver rcvr = loadInstance(className, EMPTY);
Trace.addReceiver(rcvr); Trace.addReceiver(rcvr);
@ -154,6 +150,10 @@ public class SpanReceiverHost implements TraceAdminProtocol {
private synchronized SpanReceiver loadInstance(String className, private synchronized SpanReceiver loadInstance(String className,
List<ConfigurationPair> extraConfig) throws IOException { List<ConfigurationPair> extraConfig) throws IOException {
className = className.trim();
if (!className.contains(".")) {
className = "org.htrace.impl." + className;
}
Class<?> implClass = null; Class<?> implClass = null;
SpanReceiver impl; SpanReceiver impl;
try { try {

View File

@ -13,6 +13,9 @@ Release 2.7.0 - UNRELEASED
HDFS-7186. Document the "hadoop trace" command. (Masatake Iwasaki via Colin HDFS-7186. Document the "hadoop trace" command. (Masatake Iwasaki via Colin
P. McCabe) P. McCabe)
HDFS-7202. Should be able to omit package name of SpanReceiver on "hadoop
trace -add" (iwasakims via cmccabe)
OPTIMIZATIONS OPTIMIZATIONS
BUG FIXES BUG FIXES

View File

@ -82,6 +82,14 @@ public class TestTraceAdmin {
getHostPortForNN(cluster))); getHostPortForNN(cluster)));
Assert.assertEquals("ret:0, [no span receivers found]\n", Assert.assertEquals("ret:0, [no span receivers found]\n",
runTraceCommand(trace, "-list", "-host", getHostPortForNN(cluster))); runTraceCommand(trace, "-list", "-host", getHostPortForNN(cluster)));
Assert.assertEquals("ret:0, Added trace span receiver 2 with " +
"configuration local-file-span-receiver.path = " + tracePath + "\n",
runTraceCommand(trace, "-add", "-host", getHostPortForNN(cluster),
"-class", "LocalFileSpanReceiver",
"-Clocal-file-span-receiver.path=" + tracePath));
Assert.assertEquals("ret:0, Removed trace span receiver 2\n",
runTraceCommand(trace, "-remove", "2", "-host",
getHostPortForNN(cluster)));
} finally { } finally {
cluster.shutdown(); cluster.shutdown();
tempDir.close(); tempDir.close();