Skip to content

Commit 302d9ea

Browse files
committed
HBASE-25373 Remove HTrace completely in code base and try to make use of OpenTelemetry
Signed-off-by: stack <[email protected]>
1 parent 9895b2d commit 302d9ea

File tree

42 files changed

+341
-898
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+341
-898
lines changed

hbase-asyncfs/src/test/java/org/apache/hadoop/hbase/io/asyncfs/AsyncFSTestBase.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,9 @@
1919

2020
import java.io.File;
2121
import java.io.IOException;
22-
2322
import org.apache.hadoop.conf.Configuration;
2423
import org.apache.hadoop.fs.Path;
2524
import org.apache.hadoop.hbase.HBaseCommonTestingUtility;
26-
import org.apache.hadoop.hbase.trace.TraceUtil;
2725
import org.apache.hadoop.hdfs.MiniDFSCluster;
2826
import org.slf4j.Logger;
2927
import org.slf4j.LoggerFactory;
@@ -99,7 +97,6 @@ protected static void startMiniDFSCluster(int servers) throws IOException {
9997

10098
Configuration conf = UTIL.getConfiguration();
10199

102-
TraceUtil.initTracer(conf);
103100
CLUSTER = new MiniDFSCluster.Builder(conf).numDataNodes(servers).build();
104101
CLUSTER.waitClusterUp();
105102
}

hbase-client/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,8 @@
133133
<artifactId>zookeeper</artifactId>
134134
</dependency>
135135
<dependency>
136-
<groupId>org.apache.htrace</groupId>
137-
<artifactId>htrace-core4</artifactId>
136+
<groupId>io.opentelemetry</groupId>
137+
<artifactId>opentelemetry-api</artifactId>
138138
</dependency>
139139
<dependency>
140140
<groupId>org.jruby.jcodings</groupId>

hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/BlockingRpcConnection.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@
2424
import static org.apache.hadoop.hbase.ipc.IPCUtil.setCancelled;
2525
import static org.apache.hadoop.hbase.ipc.IPCUtil.write;
2626

27+
import io.opentelemetry.api.trace.Span;
28+
import io.opentelemetry.context.Context;
29+
import io.opentelemetry.context.Scope;
2730
import java.io.BufferedInputStream;
2831
import java.io.BufferedOutputStream;
2932
import java.io.DataInputStream;
@@ -62,7 +65,6 @@
6265
import org.apache.hadoop.net.NetUtils;
6366
import org.apache.hadoop.security.UserGroupInformation;
6467
import org.apache.hadoop.util.StringUtils;
65-
import org.apache.htrace.core.TraceScope;
6668
import org.apache.yetus.audience.InterfaceAudience;
6769
import org.slf4j.Logger;
6870
import org.slf4j.LoggerFactory;
@@ -593,9 +595,12 @@ private void negotiateCryptoAes(RPCProtos.CryptoCipherMeta cryptoCipherMeta)
593595
}
594596

595597
private void tracedWriteRequest(Call call) throws IOException {
596-
try (TraceScope ignored = TraceUtil.createTrace("RpcClientImpl.tracedWriteRequest",
597-
call.span)) {
598+
Span span = TraceUtil.getGlobalTracer().spanBuilder("RpcClientImpl.tracedWriteRequest")
599+
.setParent(Context.current().with(call.span)).startSpan();
600+
try (Scope scope = span.makeCurrent()) {
598601
writeRequest(call);
602+
} finally {
603+
span.end();
599604
}
600605
}
601606

hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/Call.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,21 @@
1717
*/
1818
package org.apache.hadoop.hbase.ipc;
1919

20+
import io.opentelemetry.api.trace.Span;
2021
import java.io.IOException;
2122
import java.util.Optional;
2223
import org.apache.commons.lang3.builder.ToStringBuilder;
2324
import org.apache.commons.lang3.builder.ToStringStyle;
2425
import org.apache.hadoop.hbase.CellScanner;
2526
import org.apache.hadoop.hbase.client.MetricsConnection;
2627
import org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
27-
import org.apache.htrace.core.Span;
28-
import org.apache.htrace.core.Tracer;
2928
import org.apache.yetus.audience.InterfaceAudience;
29+
3030
import org.apache.hbase.thirdparty.com.google.protobuf.Descriptors;
3131
import org.apache.hbase.thirdparty.com.google.protobuf.Message;
3232
import org.apache.hbase.thirdparty.com.google.protobuf.RpcCallback;
3333
import org.apache.hbase.thirdparty.io.netty.util.Timeout;
34+
3435
import org.apache.hadoop.hbase.shaded.protobuf.ProtobufUtil;
3536

3637
/** A call waiting for a value. */
@@ -73,7 +74,7 @@ protected Call(int id, final Descriptors.MethodDescriptor md, Message param,
7374
this.timeout = timeout;
7475
this.priority = priority;
7576
this.callback = callback;
76-
this.span = Tracer.getCurrentSpan();
77+
this.span = Span.current();
7778
}
7879

7980
/**

hbase-common/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,8 +193,8 @@
193193
</dependency>
194194
<!-- tracing Dependencies -->
195195
<dependency>
196-
<groupId>org.apache.htrace</groupId>
197-
<artifactId>htrace-core4</artifactId>
196+
<groupId>io.opentelemetry</groupId>
197+
<artifactId>opentelemetry-api</artifactId>
198198
</dependency>
199199
<dependency>
200200
<groupId>org.apache.commons</groupId>

hbase-common/src/main/java/org/apache/hadoop/hbase/trace/HBaseHTraceConfiguration.java

Lines changed: 0 additions & 80 deletions
This file was deleted.

hbase-common/src/main/java/org/apache/hadoop/hbase/trace/SpanReceiverHost.java

Lines changed: 0 additions & 120 deletions
This file was deleted.

0 commit comments

Comments
 (0)