nisiyong edited a comment on issue #6441:
URL: https://github.com/apache/skywalking/issues/6441#issuecomment-801011967
> I don't know actually. Look like. Maybe version mismatch, usage mismatch.
Same as previous comments, we need you to check locally with our existing
plugin codes and test cases.
I met this exception on our production agent log, too. Today I debug the
plugin and figure it out.
The `hbase-1.x-plugin` only suits the HBase client 1.x, cause after HBase
2.x, `HTable` has changed its constructor function. So when use
hbase-client-2.x will meet this exception.
## Environment
- **SkyWalking Agent**: 8.2.0
- **HBase Client**: 2.1.0 (1.x works fine)
## Agent Log
```
ERROR 2021-03-17 18:31:53:844 http-nio-8080-exec-4 InstMethodsInter :
class[class org.apache.hadoop.hbase.client.HTable] before method[delete]
intercept failure
java.lang.IllegalStateException: Exit span doesn't include meaningful peer
information.
at
org.apache.skywalking.apm.agent.core.context.TracingContext.inject(TracingContext.java:163)
at
org.apache.skywalking.apm.agent.core.context.TracingContext.inject(TracingContext.java:143)
at
org.apache.skywalking.apm.agent.core.context.ContextManager.createExitSpan(ContextManager.java:126)
at
org.apache.skywalking.apm.plugin.hbase.HTableInterceptor.beforeMethod(HTableInterceptor.java:72)
at
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstMethodsInter.intercept(InstMethodsInter.java:76)
at org.apache.hadoop.hbase.client.HTable.delete(HTable.java)
at
org.apache.skywalking.apm.testcase.hbase.controller.HBaseController.hbaseCase(HBaseController.java:91)
```
## 1.x HTable contructor (from version 1.0.0 to 1.6.0)
source code:
[HTable.java](https://github.com/apache/hbase/blob/rel/1.6.0/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HTable.java)
```java
@InterfaceAudience.Private
public HTable(TableName tableName, final ClusterConnection connection,
final ConnectionConfiguration tableConfig,
final RpcRetryingCallerFactory rpcCallerFactory,
final RpcControllerFactory rpcControllerFactory,
final ExecutorService pool) throws IOException {
...
}
```
## 2.x HTable contructor (from version 2.0.0 to 2.1.9)
source code:
[HTable.java](https://github.com/apache/hbase/blob/rel/2.0.0/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HTable.java)
```java
@InterfaceAudience.Private
protected HTable(final ClusterConnection connection,
final TableBuilderBase builder,
final RpcRetryingCallerFactory rpcCallerFactory,
final RpcControllerFactory rpcControllerFactory,
final ExecutorService pool) {
...
}
```
## 2.x HTable contructor (after version 2.2.0 include 2.2.0)
source code:
[HTable.java](https://github.com/apache/hbase/blob/rel/2.4.1/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HTable.java)
```java
@InterfaceAudience.Private
protected HTable(final ConnectionImplementation connection,
final TableBuilderBase builder,
final RpcRetryingCallerFactory rpcCallerFactory,
final RpcControllerFactory rpcControllerFactory,
final ExecutorService pool) {
...
}
```
The above difference cause
`org.apache.skywalking.apm.plugin.hbase.HTableInterceptor#onConstruct` could
not set the zk address in `EnhancedInstance`, and when invoke
`ContextManager.createExitSpan` will pass the empty peer.
```java
public void onConstruct(EnhancedInstance objInst, Object[] allArguments)
throws Throwable {
Configuration connection = ((ClusterConnection)
allArguments[1]).getConfiguration();
Field field = connection.getClass().getDeclaredField("overlay");
field.setAccessible(true);
Properties properties = (Properties) field.get(connection);
for (Map.Entry entry : properties.entrySet()) {
if ("hbase.zookeeper.quorum".equals(entry.getKey())) {
objInst.setSkyWalkingDynamicField(entry.getValue().toString());
}
}
}
```
I have fixed the plugin now, but I need some help. The current plugin named
`hbase-1.x.-plugin`, I want to add a new plugin `hbase-2.x-plugin`, but I was
confused which plugin will be work at runtime because both of them enhance the
same class `org.apache.hadoop.hbase.client.HTable`.
I want to know more about how does the plugin work on multi-version.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]