diff --git a/hbase-client/pom.xml b/hbase-client/pom.xml index 3756ba39e14..f21f439596c 100644 --- a/hbase-client/pom.xml +++ b/hbase-client/pom.xml @@ -133,7 +133,7 @@ zookeeper - org.htrace + org.apache.htrace htrace-core diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncProcess.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncProcess.java index 735c20ae1e8..eef4035f569 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncProcess.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncProcess.java @@ -52,7 +52,7 @@ import org.apache.hadoop.hbase.client.coprocessor.Batch; import org.apache.hadoop.hbase.ipc.RpcControllerFactory; import org.apache.hadoop.hbase.util.Bytes; import org.apache.hadoop.hbase.util.EnvironmentEdgeManager; -import org.htrace.Trace; +import org.apache.htrace.Trace; import com.google.common.annotations.VisibleForTesting; diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ResultBoundedCompletionService.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ResultBoundedCompletionService.java index 1dab7765238..eacbe2ddd51 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ResultBoundedCompletionService.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ResultBoundedCompletionService.java @@ -25,7 +25,7 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; import org.apache.hadoop.hbase.classification.InterfaceAudience; -import org.htrace.Trace; +import org.apache.htrace.Trace; /** * A completion service for the RpcRetryingCallerFactory. @@ -162,4 +162,4 @@ public class ResultBoundedCompletionService { if (future != null) future.cancel(true); } } -} \ No newline at end of file +} diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/RpcClientImpl.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/RpcClientImpl.java index 97fa475a069..0b45eb1f4cc 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/RpcClientImpl.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/RpcClientImpl.java @@ -60,9 +60,9 @@ import org.apache.hadoop.security.UserGroupInformation; import org.apache.hadoop.security.token.Token; import org.apache.hadoop.security.token.TokenIdentifier; import org.apache.hadoop.security.token.TokenSelector; -import org.htrace.Span; -import org.htrace.Trace; -import org.htrace.TraceScope; +import org.apache.htrace.Span; +import org.apache.htrace.Trace; +import org.apache.htrace.TraceScope; import javax.net.SocketFactory; import javax.security.sasl.SaslException; diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/zookeeper/RecoverableZooKeeper.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/zookeeper/RecoverableZooKeeper.java index a72f49c77a2..4272671052c 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/zookeeper/RecoverableZooKeeper.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/zookeeper/RecoverableZooKeeper.java @@ -45,8 +45,8 @@ import org.apache.zookeeper.data.ACL; import org.apache.zookeeper.data.Stat; import org.apache.zookeeper.proto.CreateRequest; import org.apache.zookeeper.proto.SetDataRequest; -import org.htrace.Trace; -import org.htrace.TraceScope; +import org.apache.htrace.Trace; +import org.apache.htrace.TraceScope; /** * A zookeeper that can handle 'recoverable' errors. diff --git a/hbase-common/pom.xml b/hbase-common/pom.xml index 7413025cd54..ce622c0af0b 100644 --- a/hbase-common/pom.xml +++ b/hbase-common/pom.xml @@ -226,7 +226,7 @@ - org.htrace + org.apache.htrace htrace-core diff --git a/hbase-common/src/main/java/org/apache/hadoop/hbase/trace/HBaseHTraceConfiguration.java b/hbase-common/src/main/java/org/apache/hadoop/hbase/trace/HBaseHTraceConfiguration.java index b2a36d7036f..42347cee76f 100644 --- a/hbase-common/src/main/java/org/apache/hadoop/hbase/trace/HBaseHTraceConfiguration.java +++ b/hbase-common/src/main/java/org/apache/hadoop/hbase/trace/HBaseHTraceConfiguration.java @@ -20,7 +20,7 @@ package org.apache.hadoop.hbase.trace; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.classification.InterfaceAudience; -import org.htrace.HTraceConfiguration; +import org.apache.htrace.HTraceConfiguration; @InterfaceAudience.Private public class HBaseHTraceConfiguration extends HTraceConfiguration { diff --git a/hbase-common/src/main/java/org/apache/hadoop/hbase/trace/SpanReceiverHost.java b/hbase-common/src/main/java/org/apache/hadoop/hbase/trace/SpanReceiverHost.java index eb74ea17e78..b90d191e6f5 100644 --- a/hbase-common/src/main/java/org/apache/hadoop/hbase/trace/SpanReceiverHost.java +++ b/hbase-common/src/main/java/org/apache/hadoop/hbase/trace/SpanReceiverHost.java @@ -25,8 +25,9 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.classification.InterfaceAudience; -import org.htrace.SpanReceiver; -import org.htrace.Trace; +import org.apache.htrace.SpanReceiver; +import org.apache.htrace.SpanReceiverBuilder; +import org.apache.htrace.Trace; /** * This class provides functions for reading the names of SpanReceivers from @@ -67,33 +68,24 @@ public class SpanReceiverHost { } /** - * Reads the names of classes specified in the - * "hbase.trace.spanreceiver.classes" property and instantiates and registers - * them with the Tracer as SpanReceiver's. + * Reads the names of classes specified in the {@code hbase.trace.spanreceiver.classes} property + * and instantiates and registers them with the Tracer. * */ public void loadSpanReceivers() { - Class implClass = null; String[] receiverNames = conf.getStrings(SPAN_RECEIVERS_CONF_KEY); if (receiverNames == null || receiverNames.length == 0) { return; } + + SpanReceiverBuilder builder = new SpanReceiverBuilder(new HBaseHTraceConfiguration(conf)); for (String className : receiverNames) { className = className.trim(); - try { - implClass = Class.forName(className); - SpanReceiver receiver = loadInstance(implClass); - if (receiver != null) { - receivers.add(receiver); - LOG.info("SpanReceiver " + className + " was loaded successfully."); - } - - } catch (ClassNotFoundException e) { - LOG.warn("Class " + className + " cannot be found. " + e.getMessage()); - } catch (IOException e) { - LOG.warn("Load SpanReceiver " + className + " failed. " - + e.getMessage()); + SpanReceiver receiver = builder.spanReceiverClass(className).build(); + if (receiver != null) { + receivers.add(receiver); + LOG.info("SpanReceiver " + className + " was loaded successfully."); } } for (SpanReceiver rcvr : receivers) { @@ -101,28 +93,6 @@ public class SpanReceiverHost { } } - private SpanReceiver loadInstance(Class implClass) - throws IOException { - SpanReceiver impl = null; - try { - Object o = implClass.newInstance(); - impl = (SpanReceiver)o; - impl.configure(new HBaseHTraceConfiguration(this.conf)); - } catch (SecurityException e) { - throw new IOException(e); - } catch (IllegalArgumentException e) { - throw new IOException(e); - } catch (RuntimeException e) { - throw new IOException(e); - } catch (InstantiationException e) { - e.printStackTrace(); - } catch (IllegalAccessException e) { - e.printStackTrace(); - } - - return impl; - } - /** * Calls close() on all SpanReceivers created by this SpanReceiverHost. */ diff --git a/hbase-it/pom.xml b/hbase-it/pom.xml index c70f2a5785f..738d8c58575 100644 --- a/hbase-it/pom.xml +++ b/hbase-it/pom.xml @@ -202,7 +202,7 @@ commons-lang - org.htrace + org.apache.htrace htrace-core diff --git a/hbase-it/src/test/java/org/apache/hadoop/hbase/mttr/IntegrationTestMTTR.java b/hbase-it/src/test/java/org/apache/hadoop/hbase/mttr/IntegrationTestMTTR.java index 63430a10ca4..9dc2dfaad8f 100644 --- a/hbase-it/src/test/java/org/apache/hadoop/hbase/mttr/IntegrationTestMTTR.java +++ b/hbase-it/src/test/java/org/apache/hadoop/hbase/mttr/IntegrationTestMTTR.java @@ -65,10 +65,10 @@ import org.apache.hadoop.hbase.regionserver.NoSuchColumnFamilyException; import org.apache.hadoop.hbase.security.AccessDeniedException; import org.apache.hadoop.hbase.util.Bytes; import org.apache.hadoop.hbase.util.LoadTestTool; -import org.htrace.Span; -import org.htrace.Trace; -import org.htrace.TraceScope; -import org.htrace.impl.AlwaysSampler; +import org.apache.htrace.Span; +import org.apache.htrace.Trace; +import org.apache.htrace.TraceScope; +import org.apache.htrace.impl.AlwaysSampler; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; diff --git a/hbase-it/src/test/java/org/apache/hadoop/hbase/trace/IntegrationTestSendTraceRequests.java b/hbase-it/src/test/java/org/apache/hadoop/hbase/trace/IntegrationTestSendTraceRequests.java index c1dc5ea27fb..d942d9c71a8 100644 --- a/hbase-it/src/test/java/org/apache/hadoop/hbase/trace/IntegrationTestSendTraceRequests.java +++ b/hbase-it/src/test/java/org/apache/hadoop/hbase/trace/IntegrationTestSendTraceRequests.java @@ -35,9 +35,9 @@ import org.apache.hadoop.hbase.client.Table; import org.apache.hadoop.hbase.util.AbstractHBaseTool; import org.apache.hadoop.hbase.util.Bytes; import org.apache.hadoop.util.ToolRunner; -import org.htrace.Sampler; -import org.htrace.Trace; -import org.htrace.TraceScope; +import org.apache.htrace.Sampler; +import org.apache.htrace.Trace; +import org.apache.htrace.TraceScope; import org.junit.Test; import org.junit.experimental.categories.Category; diff --git a/hbase-server/pom.xml b/hbase-server/pom.xml index 9b5e53462dd..01117761ac0 100644 --- a/hbase-server/pom.xml +++ b/hbase-server/pom.xml @@ -447,7 +447,7 @@ - org.htrace + org.apache.htrace htrace-core diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/executor/EventHandler.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/executor/EventHandler.java index bf1f251a27c..541089a0c86 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/executor/EventHandler.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/executor/EventHandler.java @@ -25,9 +25,9 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.hadoop.hbase.classification.InterfaceAudience; import org.apache.hadoop.hbase.Server; -import org.htrace.Span; -import org.htrace.Trace; -import org.htrace.TraceScope; +import org.apache.htrace.Span; +import org.apache.htrace.Trace; +import org.apache.htrace.TraceScope; /** * Abstract base class for all HBase event handlers. Subclasses should diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileReaderV2.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileReaderV2.java index d58ca109a27..e466041ce55 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileReaderV2.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileReaderV2.java @@ -43,8 +43,8 @@ import org.apache.hadoop.hbase.util.ByteBufferUtils; import org.apache.hadoop.hbase.util.Bytes; import org.apache.hadoop.hbase.util.IdLock; import org.apache.hadoop.io.WritableUtils; -import org.htrace.Trace; -import org.htrace.TraceScope; +import org.apache.htrace.Trace; +import org.apache.htrace.TraceScope; import com.google.common.annotations.VisibleForTesting; diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/CallRunner.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/CallRunner.java index d4364abfb37..ef6fa88a8d1 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/CallRunner.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/CallRunner.java @@ -27,8 +27,8 @@ import org.apache.hadoop.hbase.security.UserProvider; import org.apache.hadoop.hbase.util.Pair; import org.apache.hadoop.security.UserGroupInformation; import org.apache.hadoop.util.StringUtils; -import org.htrace.Trace; -import org.htrace.TraceScope; +import org.apache.htrace.Trace; +import org.apache.htrace.TraceScope; import com.google.protobuf.Message; diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RequestContext.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RequestContext.java index 93b4313cea4..a395f2ee84d 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RequestContext.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RequestContext.java @@ -26,7 +26,7 @@ import org.apache.hadoop.hbase.security.User; import com.google.protobuf.BlockingService; import org.apache.hadoop.hbase.util.Bytes; -import org.htrace.Trace; +import org.apache.htrace.Trace; import java.net.InetAddress; diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcServer.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcServer.java index e8194a6da6e..f04ec1e391a 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcServer.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcServer.java @@ -119,7 +119,7 @@ import org.apache.hadoop.security.token.SecretManager.InvalidToken; import org.apache.hadoop.security.token.TokenIdentifier; import org.apache.hadoop.util.StringUtils; import org.codehaus.jackson.map.ObjectMapper; -import org.htrace.TraceInfo; +import org.apache.htrace.TraceInfo; import com.google.common.util.concurrent.ThreadFactoryBuilder; import com.google.protobuf.BlockingService; diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/TableMapReduceUtil.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/TableMapReduceUtil.java index 3b303bdb2df..a9d5b6b43e2 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/TableMapReduceUtil.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/TableMapReduceUtil.java @@ -729,7 +729,7 @@ public class TableMapReduceUtil { io.netty.channel.Channel.class, com.google.protobuf.Message.class, com.google.common.collect.Lists.class, - org.htrace.Trace.class); + org.apache.htrace.Trace.class); } /** diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/handler/DisableTableHandler.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/handler/DisableTableHandler.java index 80eac6c59b4..aaacfaab2af 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/handler/DisableTableHandler.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/handler/DisableTableHandler.java @@ -44,7 +44,7 @@ import org.apache.hadoop.hbase.master.TableLockManager; import org.apache.hadoop.hbase.master.RegionState.State; import org.apache.hadoop.hbase.master.TableLockManager.TableLock; import org.apache.hadoop.hbase.protobuf.generated.ZooKeeperProtos; -import org.htrace.Trace; +import org.apache.htrace.Trace; /** * Handler to run disable of a table. diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MemStoreFlusher.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MemStoreFlusher.java index 87821ec4f40..dd68b8ee8b1 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MemStoreFlusher.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MemStoreFlusher.java @@ -50,8 +50,8 @@ import org.apache.hadoop.hbase.util.EnvironmentEdgeManager; import org.apache.hadoop.hbase.util.HasThread; import org.apache.hadoop.hbase.util.Threads; import org.apache.hadoop.util.StringUtils.TraditionalBinaryPrefix; -import org.htrace.Trace; -import org.htrace.TraceScope; +import org.apache.htrace.Trace; +import org.apache.htrace.TraceScope; import org.apache.hadoop.hbase.util.Counter; import com.google.common.base.Preconditions; diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/FSHLog.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/FSHLog.java index c482fa55d62..aa64e984d0c 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/FSHLog.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/FSHLog.java @@ -85,10 +85,10 @@ import org.apache.hadoop.hbase.wal.WALProvider.Writer; import org.apache.hadoop.hbase.wal.WALSplitter; import org.apache.hadoop.hdfs.protocol.DatanodeInfo; import org.apache.hadoop.util.StringUtils; -import org.htrace.NullScope; -import org.htrace.Span; -import org.htrace.Trace; -import org.htrace.TraceScope; +import org.apache.htrace.NullScope; +import org.apache.htrace.Span; +import org.apache.htrace.Trace; +import org.apache.htrace.TraceScope; import com.google.common.annotations.VisibleForTesting; import com.google.common.collect.Maps; diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/RingBufferTruck.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/RingBufferTruck.java index 8eeef6ee60f..25c2111e2e4 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/RingBufferTruck.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/RingBufferTruck.java @@ -19,7 +19,7 @@ package org.apache.hadoop.hbase.regionserver.wal; import org.apache.hadoop.hbase.classification.InterfaceAudience; -import org.htrace.Span; +import org.apache.htrace.Span; import com.lmax.disruptor.EventFactory; diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/SyncFuture.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/SyncFuture.java index bcd23da971a..62ab4584e11 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/SyncFuture.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/SyncFuture.java @@ -21,7 +21,7 @@ import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeUnit; import org.apache.hadoop.hbase.classification.InterfaceAudience; -import org.htrace.Span; +import org.apache.htrace.Span; /** * A Future on a filesystem sync call. It given to a client or 'Handler' for it to wait on till diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/PerformanceEvaluation.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/PerformanceEvaluation.java index 53aa05c6496..5a89af4c555 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/PerformanceEvaluation.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/PerformanceEvaluation.java @@ -77,6 +77,7 @@ import org.apache.hadoop.hbase.io.encoding.DataBlockEncoding; import org.apache.hadoop.hbase.io.hfile.RandomDistribution; import org.apache.hadoop.hbase.mapreduce.TableMapReduceUtil; import org.apache.hadoop.hbase.regionserver.BloomType; +import org.apache.hadoop.hbase.trace.HBaseHTraceConfiguration; import org.apache.hadoop.hbase.trace.SpanReceiverHost; import org.apache.hadoop.hbase.util.*; import org.apache.hadoop.io.LongWritable; @@ -94,10 +95,10 @@ import com.yammer.metrics.core.Histogram; import com.yammer.metrics.stats.UniformSample; import com.yammer.metrics.stats.Snapshot; -import org.htrace.Sampler; -import org.htrace.Trace; -import org.htrace.TraceScope; -import org.htrace.impl.ProbabilitySampler; +import org.apache.htrace.Sampler; +import org.apache.htrace.Trace; +import org.apache.htrace.TraceScope; +import org.apache.htrace.impl.ProbabilitySampler; /** * Script used evaluating HBase performance and scalability. Runs a HBase @@ -921,7 +922,7 @@ public class PerformanceEvaluation extends Configured implements Tool { */ Test(final Connection con, final TestOptions options, final Status status) { this.connection = con; - this.conf = con.getConfiguration(); + this.conf = con == null ? HBaseConfiguration.create() : this.connection.getConfiguration(); this.opts = options; this.status = status; this.testName = this.getClass().getSimpleName(); @@ -929,7 +930,8 @@ public class PerformanceEvaluation extends Configured implements Tool { if (options.traceRate >= 1.0) { this.traceSampler = Sampler.ALWAYS; } else if (options.traceRate > 0.0) { - this.traceSampler = new ProbabilitySampler(options.traceRate); + conf.setDouble("hbase.sampler.fraction", options.traceRate); + this.traceSampler = new ProbabilitySampler(new HBaseHTraceConfiguration(conf)); } else { this.traceSampler = Sampler.NEVER; } diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/trace/TestHTraceHooks.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/trace/TestHTraceHooks.java index e34d44dc6d6..eba30a813c5 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/trace/TestHTraceHooks.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/trace/TestHTraceHooks.java @@ -29,12 +29,12 @@ import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.Waiter; import org.apache.hadoop.hbase.client.Put; import org.apache.hadoop.hbase.client.Table; -import org.htrace.Sampler; -import org.htrace.Span; -import org.htrace.Trace; -import org.htrace.TraceScope; -import org.htrace.TraceTree; -import org.htrace.impl.POJOSpanReceiver; +import org.apache.htrace.Sampler; +import org.apache.htrace.Span; +import org.apache.htrace.Trace; +import org.apache.htrace.TraceScope; +import org.apache.htrace.TraceTree; +import org.apache.htrace.impl.POJOSpanReceiver; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; @@ -47,11 +47,12 @@ public class TestHTraceHooks { private static final byte[] FAMILY_BYTES = "family".getBytes(); private static final HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility(); - private static final POJOSpanReceiver rcvr = new POJOSpanReceiver(); + private static POJOSpanReceiver rcvr; @BeforeClass public static void before() throws Exception { TEST_UTIL.startMiniCluster(2, 3); + rcvr = new POJOSpanReceiver(new HBaseHTraceConfiguration(TEST_UTIL.getConfiguration())); Trace.addReceiver(rcvr); } @@ -59,6 +60,7 @@ public class TestHTraceHooks { public static void after() throws Exception { TEST_UTIL.shutdownMiniCluster(); Trace.removeReceiver(rcvr); + rcvr = null; } @Test @@ -84,27 +86,25 @@ public class TestHTraceHooks { Collection spans = rcvr.getSpans(); TraceTree traceTree = new TraceTree(spans); - Collection roots = traceTree.getRoots(); + Collection roots = traceTree.getSpansByParent().find(Span.ROOT_SPAN_ID); assertEquals(1, roots.size()); Span createTableRoot = roots.iterator().next(); assertEquals("creating table", createTableRoot.getDescription()); - Multimap spansByParentIdMap = traceTree - .getSpansByParentIdMap(); int createTableCount = 0; - for (Span s : spansByParentIdMap.get(createTableRoot.getSpanId())) { + for (Span s : traceTree.getSpansByParent().find(createTableRoot.getSpanId())) { if (s.getDescription().startsWith("MasterService.CreateTable")) { createTableCount++; } } assertTrue(createTableCount >= 1); - assertTrue(spansByParentIdMap.get(createTableRoot.getSpanId()).size() > 3); + assertTrue(traceTree.getSpansByParent().find(createTableRoot.getSpanId()).size() > 3); assertTrue(spans.size() > 5); - + Put put = new Put("row".getBytes()); put.add(FAMILY_BYTES, "col".getBytes(), "value".getBytes()); @@ -117,7 +117,7 @@ public class TestHTraceHooks { spans = rcvr.getSpans(); traceTree = new TraceTree(spans); - roots = traceTree.getRoots(); + roots = traceTree.getSpansByParent().find(Span.ROOT_SPAN_ID); assertEquals(2, roots.size()); Span putRoot = null; @@ -126,7 +126,7 @@ public class TestHTraceHooks { putRoot = root; } } - + assertNotNull(putRoot); } } diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/wal/WALPerformanceEvaluation.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/wal/WALPerformanceEvaluation.java index bf8fba0d181..05d5e510c4f 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/wal/WALPerformanceEvaluation.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/wal/WALPerformanceEvaluation.java @@ -50,6 +50,7 @@ import org.apache.hadoop.hbase.client.Put; import org.apache.hadoop.hbase.io.crypto.KeyProviderForTesting; import org.apache.hadoop.hbase.regionserver.HRegion; import org.apache.hadoop.hbase.regionserver.LogRoller; +import org.apache.hadoop.hbase.trace.HBaseHTraceConfiguration; import org.apache.hadoop.hbase.trace.SpanReceiverHost; import org.apache.hadoop.hbase.wal.WALProvider.Writer; import org.apache.hadoop.hbase.wal.WAL; @@ -58,10 +59,11 @@ import org.apache.hadoop.hbase.util.FSUtils; import org.apache.hadoop.hbase.util.Threads; import org.apache.hadoop.util.Tool; import org.apache.hadoop.util.ToolRunner; -import org.htrace.Sampler; -import org.htrace.Trace; -import org.htrace.TraceScope; -import org.htrace.impl.ProbabilitySampler; +import org.apache.htrace.HTraceConfiguration; +import org.apache.htrace.Sampler; +import org.apache.htrace.Trace; +import org.apache.htrace.TraceScope; +import org.apache.htrace.impl.ProbabilitySampler; import com.yammer.metrics.core.Histogram; import com.yammer.metrics.core.Meter; @@ -150,7 +152,8 @@ public final class WALPerformanceEvaluation extends Configured implements Tool { + " SpanReciever can keep up."); } } else { - loopSampler = new ProbabilitySampler(traceFreq); + getConf().setDouble("hbase.sampler.fraction", traceFreq); + loopSampler = new ProbabilitySampler(new HBaseHTraceConfiguration(getConf())); } } } diff --git a/hbase-shell/pom.xml b/hbase-shell/pom.xml index 9e1afb9bdc6..f154cf4249f 100644 --- a/hbase-shell/pom.xml +++ b/hbase-shell/pom.xml @@ -210,7 +210,7 @@ - org.htrace + org.apache.htrace htrace-core diff --git a/hbase-shell/src/main/ruby/shell/commands/trace.rb b/hbase-shell/src/main/ruby/shell/commands/trace.rb index 2ce443b70c9..5e0093092f8 100644 --- a/hbase-shell/src/main/ruby/shell/commands/trace.rb +++ b/hbase-shell/src/main/ruby/shell/commands/trace.rb @@ -16,8 +16,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # -HTrace = org.htrace.Trace -java_import org.htrace.Sampler +HTrace = org.apache.htrace.Trace +java_import org.apache.htrace.Sampler java_import org.apache.hadoop.hbase.trace.SpanReceiverHost module Shell diff --git a/hbase-thrift/pom.xml b/hbase-thrift/pom.xml index 1bcaf924229..b736ccf0e73 100644 --- a/hbase-thrift/pom.xml +++ b/hbase-thrift/pom.xml @@ -212,7 +212,7 @@ ${project.version} - org.htrace + org.apache.htrace htrace-core diff --git a/pom.xml b/pom.xml index 0a59cb79713..6114d7ec228 100644 --- a/pom.xml +++ b/pom.xml @@ -1018,7 +1018,7 @@ 1.6.8 4.11 1.3 - 3.0.4 + 3.1.0-incubating 1.2.17 1.10.8 2.5.0 @@ -1524,7 +1524,7 @@ test - org.htrace + org.apache.htrace htrace-core ${htrace.version}