[hbase] 04/18: HBASE-26127 Backport HBASE-23898 "Add trace support for simple apis i… (#3556)

2021-09-01 Thread taklwu
This is an automated email from the ASF dual-hosted git repository.

taklwu pushed a commit to branch branch-2
in repository https://gitbox.apache.org/repos/asf/hbase.git

commit 58b5c007b9aa0ea6687aa116ee8605f33496dc3f
Author: Tak Lon (Stephen) Wu 
AuthorDate: Wed Aug 4 18:25:24 2021 -0700

HBASE-26127 Backport HBASE-23898 "Add trace support for simple apis i… 
(#3556)

4/17 commits of HBASE-22120, original commit 
805b2ae2ad0f6325515d46043ff01e4e2c7a9f59

Co-authored-by: Duo Zhang 

Signed-off-by: Duo Zhang 
---
 hbase-client/pom.xml   |  10 +
 .../hadoop/hbase/client/AsyncConnection.java   |   4 +-
 .../hadoop/hbase/client/AsyncConnectionImpl.java   | 106 +++---
 .../hadoop/hbase/client/AsyncRegionLocator.java| 166 +---
 .../org/apache/hadoop/hbase/client/AsyncTable.java |  31 +-
 .../hbase/client/AsyncTableRegionLocatorImpl.java  |  18 +-
 .../hadoop/hbase/client/ConnectionFactory.java |  53 +--
 .../hadoop/hbase/client/RawAsyncTableImpl.java | 345 +
 .../apache/hadoop/hbase/ipc/AbstractRpcClient.java |   9 +-
 .../client/TestAsyncRegionLocatorTracing.java  | 157 
 .../hadoop/hbase/client/TestAsyncTableTracing.java | 417 +
 .../org/apache/hadoop/hbase/trace/TraceUtil.java   | 134 +++
 .../org/apache/hadoop/hbase/ipc/CallRunner.java|   7 +-
 .../hadoop/hbase/ipc/ServerRpcConnection.java  |   3 +-
 .../apache/hadoop/hbase/ipc/AbstractTestIPC.java   |  24 +-
 pom.xml|   3 +-
 16 files changed, 1159 insertions(+), 328 deletions(-)

diff --git a/hbase-client/pom.xml b/hbase-client/pom.xml
index e62a7d1..01a74cc 100644
--- a/hbase-client/pom.xml
+++ b/hbase-client/pom.xml
@@ -157,6 +157,16 @@
   joni
 
 
+  io.opentelemetry
+  opentelemetry-sdk
+  test
+
+
+  io.opentelemetry
+  opentelemetry-sdk-testing
+  test
+
+
   org.slf4j
   jcl-over-slf4j
   test
diff --git 
a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncConnection.java
 
b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncConnection.java
index 75971ad..d04b5f2 100644
--- 
a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncConnection.java
+++ 
b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncConnection.java
@@ -64,8 +64,8 @@ public interface AsyncConnection extends Closeable {
   /**
* Retrieve an {@link AsyncTable} implementation for accessing a table.
* 
-   * The returned instance will use default configs. Use {@link 
#getTableBuilder(TableName)} if
-   * you want to customize some configs.
+   * The returned instance will use default configs. Use {@link 
#getTableBuilder(TableName)} if you
+   * want to customize some configs.
* 
* This method no longer checks table existence. An exception will be thrown 
if the table does not
* exist only when the first operation is attempted.
diff --git 
a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncConnectionImpl.java
 
b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncConnectionImpl.java
index 2ed7399..b919ee1 100644
--- 
a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncConnectionImpl.java
+++ 
b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncConnectionImpl.java
@@ -27,6 +27,8 @@ import static 
org.apache.hadoop.hbase.client.MetricsConnection.CLIENT_SIDE_METRI
 import static 
org.apache.hadoop.hbase.client.NonceGenerator.CLIENT_NONCES_ENABLED_KEY;
 import static org.apache.hadoop.hbase.util.FutureUtils.addListener;
 
+import io.opentelemetry.api.trace.Span;
+import io.opentelemetry.context.Scope;
 import java.io.IOException;
 import java.util.Optional;
 import java.util.concurrent.CompletableFuture;
@@ -48,6 +50,7 @@ import org.apache.hadoop.hbase.ipc.RpcClient;
 import org.apache.hadoop.hbase.ipc.RpcClientFactory;
 import org.apache.hadoop.hbase.ipc.RpcControllerFactory;
 import org.apache.hadoop.hbase.security.User;
+import org.apache.hadoop.hbase.trace.TraceUtil;
 import org.apache.hadoop.hbase.util.ConcurrentMapUtils;
 import org.apache.hadoop.hbase.util.Threads;
 import org.apache.hadoop.security.UserGroupInformation;
@@ -153,14 +156,13 @@ class AsyncConnectionImpl implements AsyncConnection {
 LOG.warn("{} is true, but {} is not set", STATUS_PUBLISHED, 
STATUS_LISTENER_CLASS);
   } else {
 try {
-  listener = new ClusterStatusListener(
-new ClusterStatusListener.DeadServerHandler() {
-  @Override
-  public void newDead(ServerName sn) {
-locator.clearCache(sn);
-rpcClient.cancelConnections(sn);
-  }
-}, conf, listenerClass);
+  listener = new ClusterStatusListener(new 
ClusterStatusListener.DeadServerHandler() {
+@Override
+public void newDead(ServerName sn) {
+  

[hbase] 04/18: HBASE-26127 Backport HBASE-23898 "Add trace support for simple apis i… (#3556)

2021-08-27 Thread taklwu
This is an automated email from the ASF dual-hosted git repository.

taklwu pushed a commit to branch HBASE-25853
in repository https://gitbox.apache.org/repos/asf/hbase.git

commit c96d8fdbd574c354d3722e19465b120cfc575388
Author: Tak Lon (Stephen) Wu 
AuthorDate: Wed Aug 4 18:25:24 2021 -0700

HBASE-26127 Backport HBASE-23898 "Add trace support for simple apis i… 
(#3556)

4/17 commits of HBASE-22120, original commit 
805b2ae2ad0f6325515d46043ff01e4e2c7a9f59

Co-authored-by: Duo Zhang 

Signed-off-by: Duo Zhang 
---
 hbase-client/pom.xml   |  10 +
 .../hadoop/hbase/client/AsyncConnection.java   |   4 +-
 .../hadoop/hbase/client/AsyncConnectionImpl.java   | 106 +++---
 .../hadoop/hbase/client/AsyncRegionLocator.java| 166 +---
 .../org/apache/hadoop/hbase/client/AsyncTable.java |  31 +-
 .../hbase/client/AsyncTableRegionLocatorImpl.java  |  18 +-
 .../hadoop/hbase/client/ConnectionFactory.java |  53 +--
 .../hadoop/hbase/client/RawAsyncTableImpl.java | 345 +
 .../apache/hadoop/hbase/ipc/AbstractRpcClient.java |   9 +-
 .../client/TestAsyncRegionLocatorTracing.java  | 157 
 .../hadoop/hbase/client/TestAsyncTableTracing.java | 417 +
 .../org/apache/hadoop/hbase/trace/TraceUtil.java   | 134 +++
 .../org/apache/hadoop/hbase/ipc/CallRunner.java|   7 +-
 .../hadoop/hbase/ipc/ServerRpcConnection.java  |   3 +-
 .../apache/hadoop/hbase/ipc/AbstractTestIPC.java   |  24 +-
 pom.xml|   3 +-
 16 files changed, 1159 insertions(+), 328 deletions(-)

diff --git a/hbase-client/pom.xml b/hbase-client/pom.xml
index e62a7d1..01a74cc 100644
--- a/hbase-client/pom.xml
+++ b/hbase-client/pom.xml
@@ -157,6 +157,16 @@
   joni
 
 
+  io.opentelemetry
+  opentelemetry-sdk
+  test
+
+
+  io.opentelemetry
+  opentelemetry-sdk-testing
+  test
+
+
   org.slf4j
   jcl-over-slf4j
   test
diff --git 
a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncConnection.java
 
b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncConnection.java
index 75971ad..d04b5f2 100644
--- 
a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncConnection.java
+++ 
b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncConnection.java
@@ -64,8 +64,8 @@ public interface AsyncConnection extends Closeable {
   /**
* Retrieve an {@link AsyncTable} implementation for accessing a table.
* 
-   * The returned instance will use default configs. Use {@link 
#getTableBuilder(TableName)} if
-   * you want to customize some configs.
+   * The returned instance will use default configs. Use {@link 
#getTableBuilder(TableName)} if you
+   * want to customize some configs.
* 
* This method no longer checks table existence. An exception will be thrown 
if the table does not
* exist only when the first operation is attempted.
diff --git 
a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncConnectionImpl.java
 
b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncConnectionImpl.java
index 2ed7399..b919ee1 100644
--- 
a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncConnectionImpl.java
+++ 
b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncConnectionImpl.java
@@ -27,6 +27,8 @@ import static 
org.apache.hadoop.hbase.client.MetricsConnection.CLIENT_SIDE_METRI
 import static 
org.apache.hadoop.hbase.client.NonceGenerator.CLIENT_NONCES_ENABLED_KEY;
 import static org.apache.hadoop.hbase.util.FutureUtils.addListener;
 
+import io.opentelemetry.api.trace.Span;
+import io.opentelemetry.context.Scope;
 import java.io.IOException;
 import java.util.Optional;
 import java.util.concurrent.CompletableFuture;
@@ -48,6 +50,7 @@ import org.apache.hadoop.hbase.ipc.RpcClient;
 import org.apache.hadoop.hbase.ipc.RpcClientFactory;
 import org.apache.hadoop.hbase.ipc.RpcControllerFactory;
 import org.apache.hadoop.hbase.security.User;
+import org.apache.hadoop.hbase.trace.TraceUtil;
 import org.apache.hadoop.hbase.util.ConcurrentMapUtils;
 import org.apache.hadoop.hbase.util.Threads;
 import org.apache.hadoop.security.UserGroupInformation;
@@ -153,14 +156,13 @@ class AsyncConnectionImpl implements AsyncConnection {
 LOG.warn("{} is true, but {} is not set", STATUS_PUBLISHED, 
STATUS_LISTENER_CLASS);
   } else {
 try {
-  listener = new ClusterStatusListener(
-new ClusterStatusListener.DeadServerHandler() {
-  @Override
-  public void newDead(ServerName sn) {
-locator.clearCache(sn);
-rpcClient.cancelConnections(sn);
-  }
-}, conf, listenerClass);
+  listener = new ClusterStatusListener(new 
ClusterStatusListener.DeadServerHandler() {
+@Override
+public void newDead(ServerName sn) {
+