Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
killuaz丶x
SkyWalking
提交
51b60ae2
S
SkyWalking
项目概览
killuaz丶x
/
SkyWalking
与 Fork 源项目一致
Fork自
apache / SkyWalking
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
SkyWalking
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
51b60ae2
编写于
3月 25, 2021
作者:
S
Stephen Ni
提交者:
GitHub
3月 25, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Update the agent HBase plugin to support HBase Client 2.x (#6577)
上级
35d7a520
变更
13
隐藏空白更改
内联
并排
Showing
13 changed file
with
186 addition
and
16 deletion
+186
-16
CHANGES.md
CHANGES.md
+1
-0
apm-sniffer/apm-sdk-plugin/hbase-1.x-2.x-plugin/pom.xml
apm-sniffer/apm-sdk-plugin/hbase-1.x-2.x-plugin/pom.xml
+3
-3
apm-sniffer/apm-sdk-plugin/hbase-1.x-2.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/hbase/HTable100Interceptor.java
...che/skywalking/apm/plugin/hbase/HTable100Interceptor.java
+41
-0
apm-sniffer/apm-sdk-plugin/hbase-1.x-2.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/hbase/HTable200Interceptor.java
...che/skywalking/apm/plugin/hbase/HTable200Interceptor.java
+41
-0
apm-sniffer/apm-sdk-plugin/hbase-1.x-2.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/hbase/HTable220Interceptor.java
...che/skywalking/apm/plugin/hbase/HTable220Interceptor.java
+43
-0
apm-sniffer/apm-sdk-plugin/hbase-1.x-2.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/hbase/HTableInterceptor.java
...apache/skywalking/apm/plugin/hbase/HTableInterceptor.java
+0
-0
apm-sniffer/apm-sdk-plugin/hbase-1.x-2.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/hbase/define/HTableInstrumentation.java
...alking/apm/plugin/hbase/define/HTableInstrumentation.java
+49
-7
apm-sniffer/apm-sdk-plugin/hbase-1.x-2.x-plugin/src/main/resources/skywalking-plugin.def
...e-1.x-2.x-plugin/src/main/resources/skywalking-plugin.def
+1
-1
apm-sniffer/apm-sdk-plugin/pom.xml
apm-sniffer/apm-sdk-plugin/pom.xml
+1
-1
docs/en/setup/service-agent/java-agent/Plugin-list.md
docs/en/setup/service-agent/java-agent/Plugin-list.md
+1
-1
docs/en/setup/service-agent/java-agent/Supported-list.md
docs/en/setup/service-agent/java-agent/Supported-list.md
+1
-1
test/plugin/scenarios/hbase-scenario/configuration.yml
test/plugin/scenarios/hbase-scenario/configuration.yml
+1
-1
test/plugin/scenarios/hbase-scenario/support-version.list
test/plugin/scenarios/hbase-scenario/support-version.list
+3
-1
未找到文件。
CHANGES.md
浏览文件 @
51b60ae2
...
...
@@ -24,6 +24,7 @@ Release Notes.
*
Collect and report agent starting / shutdown events.
*
Support jedis pipeline in jedis-2.x-plugin.
*
Fix apm-toolkit-log4j-2.x-activation no trace Id in async log.
*
Replace hbase-1.x-plugin with hbase-1.x-2.x-plugin to adapt hbase client 2.x
#### OAP-Backend
*
Allow user-defined
`JAVA_OPTS`
in the startup script.
...
...
apm-sniffer/apm-sdk-plugin/hbase-1.x-plugin/pom.xml
→
apm-sniffer/apm-sdk-plugin/hbase-1.x-
2.x-
plugin/pom.xml
浏览文件 @
51b60ae2
...
...
@@ -26,12 +26,12 @@
<version>
8.5.0-SNAPSHOT
</version>
</parent>
<artifactId>
apm-hbase-1.x-plugin
</artifactId>
<artifactId>
apm-hbase-1.x-
2.x-
plugin
</artifactId>
<packaging>
jar
</packaging>
<name>
hbase-1.x-plugin
</name>
<name>
hbase-1.x-
2.x-
plugin
</name>
<properties>
<hbase-client.version>
1.4.9
</hbase-client.version>
<hbase-client.version>
2.4.1
</hbase-client.version>
</properties>
<dependencies>
...
...
apm-sniffer/apm-sdk-plugin/hbase-1.x-2.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/hbase/HTable100Interceptor.java
0 → 100644
浏览文件 @
51b60ae2
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package
org.apache.skywalking.apm.plugin.hbase
;
import
java.lang.reflect.Field
;
import
java.util.Properties
;
import
org.apache.hadoop.conf.Configuration
;
import
org.apache.hadoop.hbase.client.ClusterConnection
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance
;
import
org.apache.skywalking.apm.util.StringUtil
;
public
class
HTable100Interceptor
extends
HTableInterceptor
{
@Override
public
void
onConstruct
(
EnhancedInstance
objInst
,
Object
[]
allArguments
)
throws
Throwable
{
Configuration
configuration
=
((
ClusterConnection
)
allArguments
[
1
]).
getConfiguration
();
Field
field
=
configuration
.
getClass
().
getDeclaredField
(
"overlay"
);
field
.
setAccessible
(
true
);
Properties
properties
=
(
Properties
)
field
.
get
(
configuration
);
String
value
=
properties
.
getProperty
(
"hbase.zookeeper.quorum"
);
if
(
StringUtil
.
isNotBlank
(
value
))
{
objInst
.
setSkyWalkingDynamicField
(
value
);
}
}
}
apm-sniffer/apm-sdk-plugin/hbase-1.x-2.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/hbase/HTable200Interceptor.java
0 → 100644
浏览文件 @
51b60ae2
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package
org.apache.skywalking.apm.plugin.hbase
;
import
java.lang.reflect.Field
;
import
java.util.Properties
;
import
org.apache.hadoop.conf.Configuration
;
import
org.apache.hadoop.hbase.client.ClusterConnection
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance
;
import
org.apache.skywalking.apm.util.StringUtil
;
public
class
HTable200Interceptor
extends
HTableInterceptor
{
@Override
public
void
onConstruct
(
EnhancedInstance
objInst
,
Object
[]
allArguments
)
throws
Throwable
{
Configuration
configuration
=
((
ClusterConnection
)
allArguments
[
0
]).
getConfiguration
();
Field
field
=
configuration
.
getClass
().
getDeclaredField
(
"overlay"
);
field
.
setAccessible
(
true
);
Properties
properties
=
(
Properties
)
field
.
get
(
configuration
);
String
value
=
properties
.
getProperty
(
"hbase.zookeeper.quorum"
);
if
(
StringUtil
.
isNotBlank
(
value
))
{
objInst
.
setSkyWalkingDynamicField
(
value
);
}
}
}
apm-sniffer/apm-sdk-plugin/hbase-1.x-2.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/hbase/HTable220Interceptor.java
0 → 100644
浏览文件 @
51b60ae2
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package
org.apache.skywalking.apm.plugin.hbase
;
import
java.lang.reflect.Field
;
import
java.lang.reflect.Method
;
import
java.util.Properties
;
import
org.apache.hadoop.conf.Configuration
;
import
org.apache.hadoop.hbase.client.Connection
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance
;
import
org.apache.skywalking.apm.util.StringUtil
;
public
class
HTable220Interceptor
extends
HTableInterceptor
{
@Override
public
void
onConstruct
(
EnhancedInstance
objInst
,
Object
[]
allArguments
)
throws
Throwable
{
Method
getConfigurationMethod
=
Connection
.
class
.
getMethod
(
"getConfiguration"
);
Configuration
configuration
=
(
Configuration
)
getConfigurationMethod
.
invoke
(
allArguments
[
0
]);
Field
field
=
configuration
.
getClass
().
getDeclaredField
(
"overlay"
);
field
.
setAccessible
(
true
);
Properties
properties
=
(
Properties
)
field
.
get
(
configuration
);
String
value
=
properties
.
getProperty
(
"hbase.zookeeper.quorum"
);
if
(
StringUtil
.
isNotBlank
(
value
))
{
objInst
.
setSkyWalkingDynamicField
(
value
);
}
}
}
apm-sniffer/apm-sdk-plugin/hbase-1.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/hbase/HTableInterceptor.java
→
apm-sniffer/apm-sdk-plugin/hbase-1.x-
2.x-
plugin/src/main/java/org/apache/skywalking/apm/plugin/hbase/HTableInterceptor.java
浏览文件 @
51b60ae2
文件已移动
apm-sniffer/apm-sdk-plugin/hbase-1.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/hbase/define/HTableInstrumentation.java
→
apm-sniffer/apm-sdk-plugin/hbase-1.x-
2.x-
plugin/src/main/java/org/apache/skywalking/apm/plugin/hbase/define/HTableInstrumentation.java
浏览文件 @
51b60ae2
...
...
@@ -47,11 +47,22 @@ import static net.bytebuddy.matcher.ElementMatchers.isPublic;
import
static
net
.
bytebuddy
.
matcher
.
ElementMatchers
.
named
;
import
static
net
.
bytebuddy
.
matcher
.
ElementMatchers
.
takesArgument
;
import
static
net
.
bytebuddy
.
matcher
.
ElementMatchers
.
takesArguments
;
import
static
org
.
apache
.
skywalking
.
apm
.
agent
.
core
.
plugin
.
bytebuddy
.
ArgumentTypeNameMatch
.
takesArgumentWithType
;
/**
* There have several interceptors to adapt different version hbase client. We use the minimal compatible version to
* name the Interceptor. eg.
* <p>HTable100Interceptor, 100 means version 1.0.0, compatible with version [1.0.0, 2.0.0)</p>
* <p>HTable200Interceptor, 200 means version 2.0.0, compatible with version [2.0.0, 2.2.0)</p>
* <p>HTable220Interceptor, 220 means version 2.2.0, compatible with version [2.2.0, )</p>
*/
public
class
HTableInstrumentation
extends
ClassInstanceMethodsEnhancePluginDefine
{
private
static
final
String
ENHANCE_CLASS
=
"org.apache.hadoop.hbase.client.HTable"
;
private
static
final
String
INTERCEPT_CLASS
=
"org.apache.skywalking.apm.plugin.hbase.HTableInterceptor"
;
private
static
final
String
INTERCEPT_CLASS_100
=
"org.apache.skywalking.apm.plugin.hbase.HTable100Interceptor"
;
private
static
final
String
INTERCEPT_CLASS_200
=
"org.apache.skywalking.apm.plugin.hbase.HTable200Interceptor"
;
private
static
final
String
INTERCEPT_CLASS_220
=
"org.apache.skywalking.apm.plugin.hbase.HTable220Interceptor"
;
@Override
protected
ClassMatch
enhanceClass
()
{
...
...
@@ -60,16 +71,44 @@ public class HTableInstrumentation extends ClassInstanceMethodsEnhancePluginDefi
@Override
public
ConstructorInterceptPoint
[]
getConstructorsInterceptPoints
()
{
return
new
ConstructorInterceptPoint
[]{
return
new
ConstructorInterceptPoint
[]
{
// compatible with version [1.0.0, 2.0.0)
new
ConstructorInterceptPoint
()
{
@Override
public
ElementMatcher
<
MethodDescription
>
getConstructorMatcher
()
{
return
takesArguments
(
6
);
return
takesArguments
(
6
)
.
and
(
takesArgumentWithType
(
0
,
"org.apache.hadoop.hbase.TableName"
));
}
@Override
public
String
getConstructorInterceptor
()
{
return
INTERCEPT_CLASS
;
return
INTERCEPT_CLASS_100
;
}
},
// compatible with version [2.0.0, 2.2.0)
new
ConstructorInterceptPoint
()
{
@Override
public
ElementMatcher
<
MethodDescription
>
getConstructorMatcher
()
{
return
takesArguments
(
5
)
.
and
(
takesArgumentWithType
(
0
,
"org.apache.hadoop.hbase.client.ClusterConnection"
));
}
@Override
public
String
getConstructorInterceptor
()
{
return
INTERCEPT_CLASS_200
;
}
},
// compatible with version [2.2.0, )
new
ConstructorInterceptPoint
()
{
@Override
public
ElementMatcher
<
MethodDescription
>
getConstructorMatcher
()
{
return
takesArguments
(
5
)
.
and
(
takesArgumentWithType
(
0
,
"org.apache.hadoop.hbase.client.ConnectionImplementation"
));
}
@Override
public
String
getConstructorInterceptor
()
{
return
INTERCEPT_CLASS_220
;
}
}
};
...
...
@@ -77,13 +116,16 @@ public class HTableInstrumentation extends ClassInstanceMethodsEnhancePluginDefi
@Override
public
InstanceMethodsInterceptPoint
[]
getInstanceMethodsInterceptPoints
()
{
return
new
InstanceMethodsInterceptPoint
[]{
return
new
InstanceMethodsInterceptPoint
[]
{
new
InstanceMethodsInterceptPoint
()
{
@Override
public
ElementMatcher
<
MethodDescription
>
getMethodsMatcher
()
{
return
named
(
"delete"
).
or
(
named
(
"put"
)).
or
(
isPublic
().
and
(
named
(
"get"
)))
.
or
(
named
(
"getScanner"
).
and
(
takesArguments
(
1
))
.
and
(
takesArgument
(
0
,
named
(
"org.apache.hadoop.hbase.client.Scan"
))));
return
named
(
"delete"
)
.
or
(
named
(
"put"
))
.
or
(
isPublic
().
and
(
named
(
"get"
)))
.
or
(
named
(
"getScanner"
)
.
and
(
takesArguments
(
1
))
.
and
(
takesArgument
(
0
,
named
(
"org.apache.hadoop.hbase.client.Scan"
))));
}
@Override
()
...
...
apm-sniffer/apm-sdk-plugin/hbase-1.x-plugin/src/main/resources/skywalking-plugin.def
→
apm-sniffer/apm-sdk-plugin/hbase-1.x-
2.x-
plugin/src/main/resources/skywalking-plugin.def
浏览文件 @
51b60ae2
...
...
@@ -14,4 +14,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.
hbase-1.x=org.apache.skywalking.apm.plugin.hbase.define.HTableInstrumentation
\ No newline at end of file
hbase-1.x/2.x=org.apache.skywalking.apm.plugin.hbase.define.HTableInstrumentation
\ No newline at end of file
apm-sniffer/apm-sdk-plugin/pom.xml
浏览文件 @
51b60ae2
...
...
@@ -97,7 +97,7 @@
<module>
mariadb-2.x-plugin
</module>
<module>
influxdb-2.x-plugin
</module>
<module>
baidu-brpc-plugin
</module>
<module>
hbase-1.x-plugin
</module>
<module>
hbase-1.x-
2.x-
plugin
</module>
<module>
graphql-plugin
</module>
<module>
xxl-job-2.x-plugin
</module>
<module>
thrift-plugin
</module>
...
...
docs/en/setup/service-agent/java-agent/Plugin-list.md
浏览文件 @
51b60ae2
...
...
@@ -23,7 +23,7 @@
-
grpc-1.x
-
gson-2.8.x
-
h2-1.x
-
hbase-1.x
-
hbase-1.x
/2.x
-
httpasyncclient-4.x
-
httpclient-3.x
-
httpclient-4.x
...
...
docs/en/setup/service-agent/java-agent/Supported-list.md
浏览文件 @
51b60ae2
...
...
@@ -83,7 +83,7 @@ metrics based on the tracing data.
*
[
Cassandra
](
https://github.com/apache/cassandra
)
3.x
*
[
cassandra-java-driver
](
https://github.com/datastax/java-driver
)
3.7.0-3.7.2
*
HBase
*
[
hbase-client
](
https://github.com/apache/hbase
)
HTable 1.
x
*
[
hbase-client
](
https://github.com/apache/hbase
)
HTable 1.
0.0-2.4.2
*
Service Discovery
*
[
Netflix Eureka
](
https://github.com/Netflix/eureka
)
*
Distributed Coordination
...
...
test/plugin/scenarios/hbase-scenario/configuration.yml
浏览文件 @
51b60ae2
...
...
@@ -24,7 +24,7 @@ depends_on:
-
hbase-server
dependencies
:
hbase-server
:
image
:
harisekhon/hbase:
1.4
image
:
harisekhon/hbase:
2.1
hostname
:
hbase-server
expose
:
-
"
2181"
...
...
test/plugin/scenarios/hbase-scenario/support-version.list
浏览文件 @
51b60ae2
...
...
@@ -16,4 +16,6 @@
1.2.6
1.3.1
1.4.9
\ No newline at end of file
1.4.9
2.1.10
2.4.2
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录