diff --git a/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestAsyncTableTracing.java b/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestAsyncTableTracing.java
index dffd2f9c9a99..0be9bdbd82e2 100644
--- a/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestAsyncTableTracing.java
+++ b/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestAsyncTableTracing.java
@@ -24,7 +24,7 @@
import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.mock;
-import io.opentelemetry.api.trace.Span.Kind;
+import io.opentelemetry.api.trace.SpanKind;
import io.opentelemetry.api.trace.StatusCode;
import io.opentelemetry.sdk.testing.junit4.OpenTelemetryRule;
import io.opentelemetry.sdk.trace.data.SpanData;
@@ -222,7 +222,7 @@ private void assertTrace(String methodName) {
Waiter.waitFor(CONF, 1000,
() -> traceRule.getSpans().stream()
.anyMatch(span -> span.getName().equals("AsyncTable." + methodName) &&
- span.getKind() == Kind.INTERNAL && span.hasEnded()));
+ span.getKind() == SpanKind.INTERNAL && span.hasEnded()));
SpanData data = traceRule.getSpans().stream()
.filter(s -> s.getName().equals("AsyncTable." + methodName)).findFirst().get();
assertEquals(StatusCode.OK, data.getStatus().getStatusCode());
@@ -406,7 +406,7 @@ public void testConnClose() throws IOException {
Waiter.waitFor(CONF, 1000,
() -> traceRule.getSpans().stream()
.anyMatch(span -> span.getName().equals("AsyncConnection.close") &&
- span.getKind() == Kind.INTERNAL && span.hasEnded()));
+ span.getKind() == SpanKind.INTERNAL && span.hasEnded()));
SpanData data = traceRule.getSpans().stream()
.filter(s -> s.getName().equals("AsyncConnection.close")).findFirst().get();
assertEquals(StatusCode.OK, data.getStatus().getStatusCode());
diff --git a/hbase-common/pom.xml b/hbase-common/pom.xml
index b294d8359409..fdefb6175d97 100644
--- a/hbase-common/pom.xml
+++ b/hbase-common/pom.xml
@@ -196,6 +196,10 @@
io.opentelemetry
opentelemetry-api
+
+ io.opentelemetry
+ opentelemetry-semconv
+
org.apache.commons
commons-crypto
diff --git a/hbase-common/src/main/java/org/apache/hadoop/hbase/trace/TraceUtil.java b/hbase-common/src/main/java/org/apache/hadoop/hbase/trace/TraceUtil.java
index 2a6b6b6588f1..43c2e048686a 100644
--- a/hbase-common/src/main/java/org/apache/hadoop/hbase/trace/TraceUtil.java
+++ b/hbase-common/src/main/java/org/apache/hadoop/hbase/trace/TraceUtil.java
@@ -20,12 +20,12 @@
import io.opentelemetry.api.GlobalOpenTelemetry;
import io.opentelemetry.api.common.AttributeKey;
import io.opentelemetry.api.trace.Span;
-import io.opentelemetry.api.trace.Span.Kind;
+import io.opentelemetry.api.trace.SpanKind;
import io.opentelemetry.api.trace.StatusCode;
import io.opentelemetry.api.trace.Tracer;
-import io.opentelemetry.api.trace.attributes.SemanticAttributes;
import io.opentelemetry.context.Context;
import io.opentelemetry.context.Scope;
+import io.opentelemetry.semconv.trace.attributes.SemanticAttributes;
import java.io.IOException;
import java.util.List;
import java.util.concurrent.CompletableFuture;
@@ -72,14 +72,14 @@ public static Tracer getGlobalTracer() {
}
/**
- * Create a {@link Kind#INTERNAL} span.
+ * Create a {@link SpanKind#INTERNAL} span.
*/
public static Span createSpan(String name) {
- return createSpan(name, Kind.INTERNAL);
+ return createSpan(name, SpanKind.INTERNAL);
}
/**
- * Create a {@link Kind#INTERNAL} span and set table related attributes.
+ * Create a {@link SpanKind#INTERNAL} span and set table related attributes.
*/
public static Span createTableSpan(String spanName, TableName tableName) {
return createSpan(spanName).setAttribute(NAMESPACE_KEY, tableName.getNamespaceAsString())
@@ -88,28 +88,29 @@ public static Span createTableSpan(String spanName, TableName tableName) {
/**
* Create a span with the given {@code kind}. Notice that, OpenTelemetry only expects one
- * {@link Kind#CLIENT} span and one {@link Kind#SERVER} span for a traced request, so use this
- * with caution when you want to create spans with kind other than {@link Kind#INTERNAL}.
+ * {@link SpanKind#CLIENT} span and one {@link SpanKind#SERVER} span for a traced request, so use
+ * this with caution when you want to create spans with kind other than {@link SpanKind#INTERNAL}.
*/
- private static Span createSpan(String name, Kind kind) {
+ private static Span createSpan(String name, SpanKind kind) {
return getGlobalTracer().spanBuilder(name).setSpanKind(kind).startSpan();
}
/**
* Create a span which parent is from remote, i.e, passed through rpc.
*
- * We will set the kind of the returned span to {@link Kind#SERVER}, as this should be the top
+ * We will set the kind of the returned span to {@link SpanKind#SERVER}, as this should be the top
* most span at server side.
*/
public static Span createRemoteSpan(String name, Context ctx) {
- return getGlobalTracer().spanBuilder(name).setParent(ctx).setSpanKind(Kind.SERVER).startSpan();
+ return getGlobalTracer().spanBuilder(name).setParent(ctx).setSpanKind(SpanKind.SERVER)
+ .startSpan();
}
/**
- * Create a span with {@link Kind#CLIENT}.
+ * Create a span with {@link SpanKind#CLIENT}.
*/
public static Span createClientSpan(String name) {
- return createSpan(name, Kind.CLIENT);
+ return createSpan(name, SpanKind.CLIENT);
}
/**
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 32f1ec876c72..c6c348a4eafb 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
@@ -54,7 +54,6 @@
import org.apache.hadoop.hbase.client.RetriesExhaustedException;
import org.apache.hadoop.hbase.client.Scan;
import org.apache.hadoop.hbase.client.Table;
-import org.apache.hadoop.hbase.client.TableDescriptor;
import org.apache.hadoop.hbase.client.TableDescriptorBuilder;
import org.apache.hadoop.hbase.coprocessor.CoprocessorException;
import org.apache.hadoop.hbase.filter.KeyOnlyFilter;
@@ -378,7 +377,7 @@ private static class TimingResult {
public void addResult(long time, Span span) {
stats.addValue(TimeUnit.MILLISECONDS.convert(time, TimeUnit.NANOSECONDS));
if (TimeUnit.SECONDS.convert(time, TimeUnit.NANOSECONDS) >= 1) {
- traces.add(span.getSpanContext().getTraceIdAsHexString());
+ traces.add(span.getSpanContext().getTraceId());
}
}
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/ServerRpcConnection.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/ServerRpcConnection.java
index 30a701e9fba6..b6293e28a573 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/ServerRpcConnection.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/ServerRpcConnection.java
@@ -23,7 +23,7 @@
import io.opentelemetry.api.trace.Span;
import io.opentelemetry.context.Context;
import io.opentelemetry.context.Scope;
-import io.opentelemetry.context.propagation.TextMapPropagator;
+import io.opentelemetry.context.propagation.TextMapGetter;
import java.io.ByteArrayInputStream;
import java.io.Closeable;
import java.io.DataOutputStream;
@@ -615,7 +615,7 @@ protected void processRequest(ByteBuff buf) throws IOException,
ProtobufUtil.mergeFrom(builder, cis, headerSize);
RequestHeader header = (RequestHeader) builder.build();
offset += headerSize;
- TextMapPropagator.Getter getter = new TextMapPropagator.Getter() {
+ TextMapGetter getter = new TextMapGetter() {
@Override
public Iterable keys(RPCTInfo carrier) {
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/ipc/AbstractTestIPC.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/ipc/AbstractTestIPC.java
index c4951b29f988..ce753430b333 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/ipc/AbstractTestIPC.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/ipc/AbstractTestIPC.java
@@ -34,7 +34,7 @@
import static org.mockito.Mockito.verify;
import static org.mockito.internal.verification.VerificationModeFactory.times;
-import io.opentelemetry.api.trace.Span.Kind;
+import io.opentelemetry.api.trace.SpanKind;
import io.opentelemetry.api.trace.StatusCode;
import io.opentelemetry.sdk.testing.junit4.OpenTelemetryRule;
import io.opentelemetry.sdk.trace.data.SpanData;
@@ -457,7 +457,7 @@ private SpanData waitSpan(String name) {
}
private void assertRpcAttribute(SpanData data, String methodName, InetSocketAddress addr,
- Kind kind) {
+ SpanKind kind) {
assertEquals(SERVICE.getDescriptorForType().getName(),
data.getAttributes().get(TraceUtil.RPC_SERVICE_KEY));
assertEquals(methodName, data.getAttributes().get(TraceUtil.RPC_METHOD_KEY));
@@ -471,7 +471,7 @@ private void assertRpcAttribute(SpanData data, String methodName, InetSocketAddr
private void assertRemoteSpan() {
SpanData data = waitSpan("RpcServer.process");
assertTrue(data.getParentSpanContext().isRemote());
- assertEquals(Kind.SERVER, data.getKind());
+ assertEquals(SpanKind.SERVER, data.getKind());
}
@Test
@@ -484,8 +484,8 @@ public void testTracing() throws IOException, ServiceException {
BlockingInterface stub = newBlockingStub(client, rpcServer.getListenerAddress());
stub.pause(null, PauseRequestProto.newBuilder().setMs(100).build());
assertRpcAttribute(waitSpan("RpcClient.callMethod"), "pause", rpcServer.getListenerAddress(),
- Kind.CLIENT);
- assertRpcAttribute(waitSpan("RpcServer.callMethod"), "pause", null, Kind.INTERNAL);
+ SpanKind.CLIENT);
+ assertRpcAttribute(waitSpan("RpcServer.callMethod"), "pause", null, SpanKind.INTERNAL);
assertRemoteSpan();
assertSameTraceId();
for (SpanData data : traceRule.getSpans()) {
@@ -499,8 +499,8 @@ public void testTracing() throws IOException, ServiceException {
assertThrows(ServiceException.class,
() -> stub.error(null, EmptyRequestProto.getDefaultInstance()));
assertRpcAttribute(waitSpan("RpcClient.callMethod"), "error", rpcServer.getListenerAddress(),
- Kind.CLIENT);
- assertRpcAttribute(waitSpan("RpcServer.callMethod"), "error", null, Kind.INTERNAL);
+ SpanKind.CLIENT);
+ assertRpcAttribute(waitSpan("RpcServer.callMethod"), "error", null, SpanKind.INTERNAL);
assertRemoteSpan();
assertSameTraceId();
for (SpanData data : traceRule.getSpans()) {
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegionTracing.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegionTracing.java
index 3a772a28059a..17c3eb4f03a2 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegionTracing.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegionTracing.java
@@ -23,6 +23,7 @@
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
+import org.apache.hadoop.fs.Path;
import org.apache.hadoop.hbase.HBaseClassTestRule;
import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.hadoop.hbase.TableName;
@@ -48,7 +49,6 @@
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
-import org.junit.BeforeClass;
import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
@@ -79,18 +79,12 @@ public class TestHRegionTracing {
@Rule
public final TableNameTestRule tableNameRule = new TableNameTestRule();
- private static WAL WAL;
+ private WAL wal;
private HRegion region;
- @BeforeClass
- public static void setUpBeforeClass() throws IOException {
- WAL = HBaseTestingUtility.createWal(UTIL.getConfiguration(), UTIL.getDataTestDir(), null);
- }
-
@AfterClass
public static void tearDownAfterClass() throws IOException {
- Closeables.close(WAL, true);
UTIL.cleanupTestDir();
}
@@ -102,7 +96,9 @@ public void setUp() throws IOException {
RegionInfo info = RegionInfoBuilder.newBuilder(tableName).build();
ChunkCreator.initialize(MemStoreLAB.CHUNK_SIZE_DEFAULT, false, 0, 0, 0, null,
MemStoreLAB.INDEX_CHUNK_SIZE_PERCENTAGE_DEFAULT);
- region = HRegion.createHRegion(info, UTIL.getDataTestDir(), UTIL.getConfiguration(), desc, WAL);
+ wal = HBaseTestingUtility.createWal(UTIL.getConfiguration(),
+ new Path(UTIL.getDataTestDir(), tableName.getNameAsString()), null);
+ region = HRegion.createHRegion(info, UTIL.getDataTestDir(), UTIL.getConfiguration(), desc, wal);
region = UTIL.createLocalHRegion(info, desc);
}
@@ -111,6 +107,7 @@ public void tearDown() throws IOException {
if (region != null) {
region.close();
}
+ Closeables.close(wal, true);
}
private void assertSpan(String spanName) {
diff --git a/pom.xml b/pom.xml
index b8ba5d053781..89477a666a33 100755
--- a/pom.xml
+++ b/pom.xml
@@ -1717,8 +1717,8 @@
9.2.13.0
4.13
1.3
- 0.13.1
- 0.13.0
+ 0.17.1
+ 0.17.0
2.14.1
2.28.2
0.6.1
@@ -2395,23 +2395,20 @@
io.opentelemetry
- opentelemetry-api
- ${opentelemetry.version}
-
-
- io.opentelemetry
- opentelemetry-sdk
+ opentelemetry-bom
${opentelemetry.version}
+ pom
+ import
io.opentelemetry
- opentelemetry-sdk-testing
- ${opentelemetry.version}
+ opentelemetry-semconv
+ ${opentelemetry.version}-alpha
io.opentelemetry.javaagent
opentelemetry-javaagent
- ${opentelemetry.version}
+ ${opentelemetry-javaagent.version}
all