Skip to content

Commit

Permalink
HBASE-25373 Remove HTrace completely in code base and try to make use…
Browse files Browse the repository at this point in the history
… of OpenTelemetry

Signed-off-by: stack <stack@apache.org>
  • Loading branch information
Apache9 committed Apr 25, 2021
1 parent 9895b2d commit 302d9ea
Show file tree
Hide file tree
Showing 42 changed files with 341 additions and 898 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,9 @@

import java.io.File;
import java.io.IOException;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.hbase.HBaseCommonTestingUtility;
import org.apache.hadoop.hbase.trace.TraceUtil;
import org.apache.hadoop.hdfs.MiniDFSCluster;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down Expand Up @@ -99,7 +97,6 @@ protected static void startMiniDFSCluster(int servers) throws IOException {

Configuration conf = UTIL.getConfiguration();

TraceUtil.initTracer(conf);
CLUSTER = new MiniDFSCluster.Builder(conf).numDataNodes(servers).build();
CLUSTER.waitClusterUp();
}
Expand Down
4 changes: 2 additions & 2 deletions hbase-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,8 @@
<artifactId>zookeeper</artifactId>
</dependency>
<dependency>
<groupId>org.apache.htrace</groupId>
<artifactId>htrace-core4</artifactId>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-api</artifactId>
</dependency>
<dependency>
<groupId>org.jruby.jcodings</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
import static org.apache.hadoop.hbase.ipc.IPCUtil.setCancelled;
import static org.apache.hadoop.hbase.ipc.IPCUtil.write;

import io.opentelemetry.api.trace.Span;
import io.opentelemetry.context.Context;
import io.opentelemetry.context.Scope;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.DataInputStream;
Expand Down Expand Up @@ -62,7 +65,6 @@
import org.apache.hadoop.net.NetUtils;
import org.apache.hadoop.security.UserGroupInformation;
import org.apache.hadoop.util.StringUtils;
import org.apache.htrace.core.TraceScope;
import org.apache.yetus.audience.InterfaceAudience;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down Expand Up @@ -593,9 +595,12 @@ private void negotiateCryptoAes(RPCProtos.CryptoCipherMeta cryptoCipherMeta)
}

private void tracedWriteRequest(Call call) throws IOException {
try (TraceScope ignored = TraceUtil.createTrace("RpcClientImpl.tracedWriteRequest",
call.span)) {
Span span = TraceUtil.getGlobalTracer().spanBuilder("RpcClientImpl.tracedWriteRequest")
.setParent(Context.current().with(call.span)).startSpan();
try (Scope scope = span.makeCurrent()) {
writeRequest(call);
} finally {
span.end();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,21 @@
*/
package org.apache.hadoop.hbase.ipc;

import io.opentelemetry.api.trace.Span;
import java.io.IOException;
import java.util.Optional;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.apache.hadoop.hbase.CellScanner;
import org.apache.hadoop.hbase.client.MetricsConnection;
import org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
import org.apache.htrace.core.Span;
import org.apache.htrace.core.Tracer;
import org.apache.yetus.audience.InterfaceAudience;

import org.apache.hbase.thirdparty.com.google.protobuf.Descriptors;
import org.apache.hbase.thirdparty.com.google.protobuf.Message;
import org.apache.hbase.thirdparty.com.google.protobuf.RpcCallback;
import org.apache.hbase.thirdparty.io.netty.util.Timeout;

import org.apache.hadoop.hbase.shaded.protobuf.ProtobufUtil;

/** A call waiting for a value. */
Expand Down Expand Up @@ -73,7 +74,7 @@ protected Call(int id, final Descriptors.MethodDescriptor md, Message param,
this.timeout = timeout;
this.priority = priority;
this.callback = callback;
this.span = Tracer.getCurrentSpan();
this.span = Span.current();
}

/**
Expand Down
4 changes: 2 additions & 2 deletions hbase-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,8 @@
</dependency>
<!-- tracing Dependencies -->
<dependency>
<groupId>org.apache.htrace</groupId>
<artifactId>htrace-core4</artifactId>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-api</artifactId>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
Expand Down

This file was deleted.

This file was deleted.

Loading

0 comments on commit 302d9ea

Please sign in to comment.