Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
killuaz丶x
SkyWalking
提交
55592615
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,发现更多精彩内容 >>
提交
55592615
编写于
6月 08, 2016
作者:
A
ascrutae
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
重构拦截点的代码,将拦截点改为继承式
上级
a5c9cd0c
变更
15
隐藏空白更改
内联
并排
Showing
15 changed file
with
357 addition
and
193 deletion
+357
-193
skywalking-api/src/main/java/com/ai/cloud/skywalking/plugin/interceptor/EnhanceClazz4Interceptor.java
...ywalking/plugin/interceptor/EnhanceClazz4Interceptor.java
+125
-143
skywalking-api/src/main/java/com/ai/cloud/skywalking/plugin/interceptor/InterceptorDefine.java
...loud/skywalking/plugin/interceptor/InterceptorDefine.java
+1
-1
skywalking-api/src/main/java/com/ai/cloud/skywalking/plugin/interceptor/MethodNameMatcher.java
...loud/skywalking/plugin/interceptor/MethodNameMatcher.java
+40
-0
skywalking-api/src/main/java/com/ai/cloud/skywalking/plugin/interceptor/matcher/AnyMethodMatcher.java
...ywalking/plugin/interceptor/matcher/AnyMethodMatcher.java
+18
-0
skywalking-api/src/main/java/com/ai/cloud/skywalking/plugin/interceptor/matcher/ExclusionNameMatcher.java
...king/plugin/interceptor/matcher/ExclusionNameMatcher.java
+36
-0
skywalking-api/src/main/java/com/ai/cloud/skywalking/plugin/interceptor/matcher/FullNameMatcher.java
...kywalking/plugin/interceptor/matcher/FullNameMatcher.java
+37
-0
skywalking-api/src/main/java/com/ai/cloud/skywalking/plugin/interceptor/matcher/RegexNameMatcher.java
...ywalking/plugin/interceptor/matcher/RegexNameMatcher.java
+37
-0
skywalking-api/src/test/java/test/ai/cloud/plugin/TestInterceptorDefine.java
...test/java/test/ai/cloud/plugin/TestInterceptorDefine.java
+4
-2
skywalking-sdk-plugin/httpClient-4.x-plugin-dubbox-rest-attachment/src/main/java/org/skywalking/httpClient/v4/plugin/dubbox/rest/attachment/DubboxRestHeadSetterAttachment.java
...ubbox/rest/attachment/DubboxRestHeadSetterAttachment.java
+2
-1
skywalking-sdk-plugin/httpClient-4.x-plugin/src/main/java/org/skywalking/httpClient/v4/plugin/define/AbstractHttpClientPluginDefine.java
...ient/v4/plugin/define/AbstractHttpClientPluginDefine.java
+5
-3
skywalking-sdk-plugin/httpClient-4.x-plugin/src/main/java/org/skywalking/httpClient/v4/plugin/define/DefaultRequestDirectorPluginDefine.java
.../v4/plugin/define/DefaultRequestDirectorPluginDefine.java
+5
-3
skywalking-sdk-plugin/httpClient-4.x-plugin/src/main/java/org/skywalking/httpClient/v4/plugin/define/InternalHttpClientPluginDefine.java
...ient/v4/plugin/define/InternalHttpClientPluginDefine.java
+11
-10
skywalking-sdk-plugin/httpClient-4.x-plugin/src/main/java/org/skywalking/httpClient/v4/plugin/define/MinimalHttpClientPluginDefine.java
...lient/v4/plugin/define/MinimalHttpClientPluginDefine.java
+11
-10
skywalking-sdk-plugin/jedis-2.x-plugin/src/main/java/org/skywalking/jedis/v2/plugin/define/JedisPluginDefine.java
.../skywalking/jedis/v2/plugin/define/JedisPluginDefine.java
+17
-14
skywalking-sdk-plugin/mysql-plugin/src/main/java/com/ai/cloud/skywalking/plugin/mysql/ConnectionPluginDefine.java
...cloud/skywalking/plugin/mysql/ConnectionPluginDefine.java
+8
-6
未找到文件。
skywalking-api/src/main/java/com/ai/cloud/skywalking/plugin/interceptor/EnhanceClazz4Interceptor.java
浏览文件 @
55592615
package
com.ai.cloud.skywalking.plugin.interceptor
;
import
static
net
.
bytebuddy
.
matcher
.
ElementMatchers
.
any
;
import
static
net
.
bytebuddy
.
matcher
.
ElementMatchers
.
named
;
import
static
net
.
bytebuddy
.
matcher
.
ElementMatchers
.
takesArguments
;
import
java.util.List
;
import
com.ai.cloud.skywalking.plugin.PluginCfg
;
import
com.ai.cloud.skywalking.util.StringUtil
;
import
net.bytebuddy.ByteBuddy
;
import
net.bytebuddy.description.method.MethodDescription
;
import
net.bytebuddy.dynamic.ClassFileLocator
;
import
net.bytebuddy.dynamic.DynamicType
;
import
net.bytebuddy.dynamic.loading.ClassLoadingStrategy
;
...
...
@@ -16,146 +13,131 @@ import net.bytebuddy.implementation.SuperMethodCall;
import
net.bytebuddy.implementation.bind.annotation.FieldProxy
;
import
net.bytebuddy.pool.TypePool
;
import
net.bytebuddy.pool.TypePool.Resolution
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
com.ai.cloud.skywalking.plugin.PluginCfg
;
import
com.ai.cloud.skywalking.util.StringUtil
;
import
java.util.List
;
import
static
net
.
bytebuddy
.
matcher
.
ElementMatchers
.
any
;
public
class
EnhanceClazz4Interceptor
{
private
static
Logger
logger
=
LogManager
.
getLogger
(
EnhanceClazz4Interceptor
.
class
);
private
TypePool
typePool
;
public
static
final
String
contextAttrName
=
"_$EnhancedClassInstanceContext"
;
public
EnhanceClazz4Interceptor
()
{
typePool
=
TypePool
.
Default
.
ofClassPath
();
}
public
void
enhance
()
{
List
<
String
>
interceptorClassList
=
PluginCfg
.
CFG
.
getInterceptorClassList
();
for
(
String
interceptorClassName
:
interceptorClassList
)
{
try
{
enhance0
(
interceptorClassName
);
}
catch
(
Throwable
t
)
{
logger
.
error
(
"enhance class [{}] for intercept failure."
,
interceptorClassName
,
t
);
}
}
}
private
void
enhance0
(
String
interceptorDefineClassName
)
throws
InstantiationException
,
IllegalAccessException
,
ClassNotFoundException
,
EnhanceException
{
logger
.
debug
(
"prepare to enhance class by {}."
,
interceptorDefineClassName
);
InterceptorDefine
define
=
(
InterceptorDefine
)
Class
.
forName
(
interceptorDefineClassName
).
newInstance
();
String
enhanceOriginClassName
=
define
.
getBeInterceptedClassName
();
if
(
StringUtil
.
isEmpty
(
enhanceOriginClassName
)){
logger
.
warn
(
"classname of being intercepted is not defined by {}."
,
interceptorDefineClassName
);
return
;
}
logger
.
debug
(
"prepare to enhance class {} by {}."
,
enhanceOriginClassName
,
interceptorDefineClassName
);
Resolution
resolution
=
typePool
.
describe
(
enhanceOriginClassName
);
if
(!
resolution
.
isResolved
()){
logger
.
warn
(
"class {} can't be resolved, enhance by {} failue."
,
enhanceOriginClassName
,
interceptorDefineClassName
);
return
;
}
/**
* rename origin class <br/>
* add '$$Origin' at the end of be enhanced classname <br/>
* such as: class com.ai.cloud.TestClass to class
* com.ai.cloud.TestClass$$Origin
*/
String
renameClassName
=
enhanceOriginClassName
+
"$$Origin"
;
Class
<?>
originClass
=
new
ByteBuddy
()
.
redefine
(
resolution
.
resolve
(),
ClassFileLocator
.
ForClassLoader
.
ofClassPath
())
.
name
(
renameClassName
)
.
make
()
.
load
(
ClassLoader
.
getSystemClassLoader
(),
ClassLoadingStrategy
.
Default
.
INJECTION
).
getLoaded
();
/**
* create a new class using origin classname.<br/>
*
* new class need:<br/>
* 1.add field '_$EnhancedClassInstanceContext' of type
* EnhancedClassInstanceContext <br/>
*
* 2.intercept constructor by default, and intercept method which it's
* required by interceptorDefineClass. <br/>
*/
IAroundInterceptor
interceptor
=
define
.
instance
();
if
(
interceptor
==
null
){
throw
new
EnhanceException
(
"no IAroundInterceptor instance. "
);
}
DynamicType
.
Builder
<?>
newClassBuilder
=
new
ByteBuddy
().
subclass
(
originClass
,
ConstructorStrategy
.
Default
.
IMITATE_SUPER_CLASS
);
newClassBuilder
=
newClassBuilder
.
defineField
(
contextAttrName
,
EnhancedClassInstanceContext
.
class
)
.
constructor
(
any
())
.
intercept
(
SuperMethodCall
.
INSTANCE
.
andThen
(
MethodDelegation
.
to
(
new
ClassConstructorInterceptor
(
interceptor
))
.
appendParameterBinder
(
FieldProxy
.
Binder
.
install
(
FieldGetter
.
class
,
FieldSetter
.
class
))));
InterceptPoint
[]
methodNameList
=
define
.
getBeInterceptedMethods
();
ClassMethodInterceptor
classMethodInterceptor
=
new
ClassMethodInterceptor
(
interceptor
);
for
(
InterceptPoint
method
:
methodNameList
)
{
logger
.
debug
(
"prepare to enhance class {} method [{}] "
,
enhanceOriginClassName
,
method
.
getMethodName
());
if
(
method
.
getArgTypeArray
()
!=
null
)
{
newClassBuilder
=
newClassBuilder
.
method
(
named
(
method
.
getMethodName
()).
and
(
takesArguments
(
method
.
getArgTypeArray
()))).
intercept
(
MethodDelegation
.
to
(
classMethodInterceptor
));
}
else
if
(
method
.
getArgNum
()
>
-
1
)
{
newClassBuilder
=
newClassBuilder
.
method
(
named
(
method
.
getMethodName
()).
and
(
takesArguments
(
method
.
getArgNum
()))).
intercept
(
MethodDelegation
.
to
(
classMethodInterceptor
));
}
else
if
(
"*"
.
equals
(
method
.
getMethodName
())){
newClassBuilder
=
newClassBuilder
.
method
(
any
()).
intercept
(
MethodDelegation
.
to
(
classMethodInterceptor
));
}
else
{
newClassBuilder
=
newClassBuilder
.
method
(
named
(
method
.
getMethodName
())).
intercept
(
MethodDelegation
.
to
(
classMethodInterceptor
));
}
}
/**
* naming class as origin class name, make and load class to
* classloader.
*/
newClassBuilder
.
name
(
enhanceOriginClassName
)
.
make
()
.
load
(
ClassLoader
.
getSystemClassLoader
(),
ClassLoadingStrategy
.
Default
.
INJECTION
).
getLoaded
();
logger
.
debug
(
"enhance class {} by {} completely."
,
enhanceOriginClassName
,
interceptorDefineClassName
);
}
private
static
Logger
logger
=
LogManager
.
getLogger
(
EnhanceClazz4Interceptor
.
class
);
private
TypePool
typePool
;
public
static
final
String
contextAttrName
=
"_$EnhancedClassInstanceContext"
;
public
EnhanceClazz4Interceptor
()
{
typePool
=
TypePool
.
Default
.
ofClassPath
();
}
public
void
enhance
()
{
List
<
String
>
interceptorClassList
=
PluginCfg
.
CFG
.
getInterceptorClassList
();
for
(
String
interceptorClassName
:
interceptorClassList
)
{
try
{
enhance0
(
interceptorClassName
);
}
catch
(
Throwable
t
)
{
logger
.
error
(
"enhance class [{}] for intercept failure."
,
interceptorClassName
,
t
);
}
}
}
private
void
enhance0
(
String
interceptorDefineClassName
)
throws
InstantiationException
,
IllegalAccessException
,
ClassNotFoundException
,
EnhanceException
{
logger
.
debug
(
"prepare to enhance class by {}."
,
interceptorDefineClassName
);
InterceptorDefine
define
=
(
InterceptorDefine
)
Class
.
forName
(
interceptorDefineClassName
).
newInstance
();
String
enhanceOriginClassName
=
define
.
getBeInterceptedClassName
();
if
(
StringUtil
.
isEmpty
(
enhanceOriginClassName
))
{
logger
.
warn
(
"classname of being intercepted is not defined by {}."
,
interceptorDefineClassName
);
return
;
}
logger
.
debug
(
"prepare to enhance class {} by {}."
,
enhanceOriginClassName
,
interceptorDefineClassName
);
Resolution
resolution
=
typePool
.
describe
(
enhanceOriginClassName
);
if
(!
resolution
.
isResolved
())
{
logger
.
warn
(
"class {} can't be resolved, enhance by {} failue."
,
enhanceOriginClassName
,
interceptorDefineClassName
);
return
;
}
/**
* rename origin class <br/>
* add '$$Origin' at the end of be enhanced classname <br/>
* such as: class com.ai.cloud.TestClass to class
* com.ai.cloud.TestClass$$Origin
*/
String
renameClassName
=
enhanceOriginClassName
+
"$$Origin"
;
Class
<?>
originClass
=
new
ByteBuddy
()
.
redefine
(
resolution
.
resolve
(),
ClassFileLocator
.
ForClassLoader
.
ofClassPath
())
.
name
(
renameClassName
)
.
make
()
.
load
(
ClassLoader
.
getSystemClassLoader
(),
ClassLoadingStrategy
.
Default
.
INJECTION
).
getLoaded
();
/**
* create a new class using origin classname.<br/>
*
* new class need:<br/>
* 1.add field '_$EnhancedClassInstanceContext' of type
* EnhancedClassInstanceContext <br/>
*
* 2.intercept constructor by default, and intercept method which it's
* required by interceptorDefineClass. <br/>
*/
IAroundInterceptor
interceptor
=
define
.
instance
();
if
(
interceptor
==
null
)
{
throw
new
EnhanceException
(
"no IAroundInterceptor instance. "
);
}
DynamicType
.
Builder
<?>
newClassBuilder
=
new
ByteBuddy
().
subclass
(
originClass
,
ConstructorStrategy
.
Default
.
IMITATE_SUPER_CLASS
);
newClassBuilder
=
newClassBuilder
.
defineField
(
contextAttrName
,
EnhancedClassInstanceContext
.
class
)
.
constructor
(
any
())
.
intercept
(
SuperMethodCall
.
INSTANCE
.
andThen
(
MethodDelegation
.
to
(
new
ClassConstructorInterceptor
(
interceptor
))
.
appendParameterBinder
(
FieldProxy
.
Binder
.
install
(
FieldGetter
.
class
,
FieldSetter
.
class
))));
MethodNameMatcher
[]
methodNameList
=
define
.
getBeInterceptedMethods
();
ClassMethodInterceptor
classMethodInterceptor
=
new
ClassMethodInterceptor
(
interceptor
);
for
(
MethodNameMatcher
method
:
methodNameList
)
{
logger
.
debug
(
"prepare to enhance class {} method [{}] "
,
enhanceOriginClassName
,
method
.
getMethodMatchDescribe
());
newClassBuilder
=
newClassBuilder
.
method
(
method
.<
MethodDescription
>
builderMatcher
()).
intercept
(
MethodDelegation
.
to
(
classMethodInterceptor
));
}
/**
* naming class as origin class name, make and load class to
* classloader.
*/
newClassBuilder
.
name
(
enhanceOriginClassName
)
.
make
()
.
load
(
ClassLoader
.
getSystemClassLoader
(),
ClassLoadingStrategy
.
Default
.
INJECTION
).
getLoaded
();
logger
.
debug
(
"enhance class {} by {} completely."
,
enhanceOriginClassName
,
interceptorDefineClassName
);
}
}
skywalking-api/src/main/java/com/ai/cloud/skywalking/plugin/interceptor/InterceptorDefine.java
浏览文件 @
55592615
...
...
@@ -13,7 +13,7 @@ public interface InterceptorDefine {
*
* @return
*/
public
InterceptPoint
[]
getBeInterceptedMethods
();
public
MethodNameMatcher
[]
getBeInterceptedMethods
();
/**
* 返回增强拦截器的实现<br/>
...
...
skywalking-api/src/main/java/com/ai/cloud/skywalking/plugin/interceptor/MethodNameMatcher.java
0 → 100644
浏览文件 @
55592615
package
com.ai.cloud.skywalking.plugin.interceptor
;
import
net.bytebuddy.matcher.ElementMatcher
;
public
abstract
class
MethodNameMatcher
<
T
>
{
private
String
methodMatchDescribe
;
private
int
argNum
=
-
1
;
private
Class
<?>[]
argTypeArray
;
public
MethodNameMatcher
(
String
methodMatchDescribe
)
{
this
.
methodMatchDescribe
=
methodMatchDescribe
;
}
public
MethodNameMatcher
(
String
methodMatchDescribe
,
int
argNum
)
{
this
.
methodMatchDescribe
=
methodMatchDescribe
;
this
.
argNum
=
argNum
;
}
public
MethodNameMatcher
(
String
methodMatchDescribe
,
Class
<?>[]
argTypeArray
)
{
this
.
argTypeArray
=
argTypeArray
;
this
.
methodMatchDescribe
=
methodMatchDescribe
;
}
public
abstract
<
T
>
ElementMatcher
<
T
>
builderMatcher
();
protected
String
getMethodMatchDescribe
()
{
return
methodMatchDescribe
;
}
protected
int
getArgNum
()
{
return
argNum
;
}
protected
Class
<?>[]
getArgTypeArray
()
{
return
argTypeArray
;
}
}
skywalking-api/src/main/java/com/ai/cloud/skywalking/plugin/interceptor/matcher/AnyMethodMatcher.java
0 → 100644
浏览文件 @
55592615
package
com.ai.cloud.skywalking.plugin.interceptor.matcher
;
import
com.ai.cloud.skywalking.plugin.interceptor.MethodNameMatcher
;
import
net.bytebuddy.matcher.ElementMatcher
;
import
static
net
.
bytebuddy
.
matcher
.
ElementMatchers
.
any
;
public
class
AnyMethodMatcher
extends
MethodNameMatcher
{
public
AnyMethodMatcher
()
{
super
(
"*"
);
}
@Override
public
ElementMatcher
builderMatcher
()
{
return
any
();
}
}
skywalking-api/src/main/java/com/ai/cloud/skywalking/plugin/interceptor/matcher/ExclusionNameMatcher.java
0 → 100644
浏览文件 @
55592615
package
com.ai.cloud.skywalking.plugin.interceptor.matcher
;
import
com.ai.cloud.skywalking.plugin.interceptor.MethodNameMatcher
;
import
net.bytebuddy.matcher.ElementMatcher
;
import
static
net
.
bytebuddy
.
matcher
.
ElementMatchers
.*;
public
class
ExclusionNameMatcher
extends
MethodNameMatcher
{
public
ExclusionNameMatcher
(
String
methodMatchDescribe
)
{
super
(
methodMatchDescribe
);
}
public
ExclusionNameMatcher
(
String
methodMatchDescribe
,
int
argNum
)
{
super
(
methodMatchDescribe
,
argNum
);
}
public
ExclusionNameMatcher
(
String
methodMatchDescribe
,
Class
[]
argTypeArray
)
{
super
(
methodMatchDescribe
,
argTypeArray
);
}
@Override
public
ElementMatcher
builderMatcher
()
{
ElementMatcher
.
Junction
matcher
=
not
(
named
(
getMethodMatchDescribe
()));
if
(
getArgTypeArray
()
!=
null
)
{
matcher
.
and
(
takesArguments
(
getArgTypeArray
()));
}
if
(
getArgNum
()
>
-
1
)
{
matcher
.
and
(
takesArguments
(
getArgNum
()));
}
return
matcher
;
}
}
skywalking-api/src/main/java/com/ai/cloud/skywalking/plugin/interceptor/matcher/FullNameMatcher.java
0 → 100644
浏览文件 @
55592615
package
com.ai.cloud.skywalking.plugin.interceptor.matcher
;
import
com.ai.cloud.skywalking.plugin.interceptor.MethodNameMatcher
;
import
net.bytebuddy.matcher.ElementMatcher
;
import
static
net
.
bytebuddy
.
matcher
.
ElementMatchers
.
named
;
import
static
net
.
bytebuddy
.
matcher
.
ElementMatchers
.
takesArguments
;
public
class
FullNameMatcher
extends
MethodNameMatcher
{
public
FullNameMatcher
(
String
methodName
)
{
super
(
methodName
);
}
public
FullNameMatcher
(
String
methodName
,
int
argNum
)
{
super
(
methodName
,
argNum
);
}
public
FullNameMatcher
(
String
methodName
,
Class
<?>...
args
)
{
super
(
methodName
,
args
);
}
@Override
public
ElementMatcher
builderMatcher
()
{
ElementMatcher
.
Junction
matcher
=
named
(
getMethodMatchDescribe
());
if
(
getArgTypeArray
()
!=
null
)
{
matcher
.
and
(
takesArguments
(
getArgTypeArray
()));
}
if
(
getArgNum
()
>
-
1
)
{
matcher
.
and
(
takesArguments
(
getArgNum
()));
}
return
matcher
;
}
}
skywalking-api/src/main/java/com/ai/cloud/skywalking/plugin/interceptor/matcher/RegexNameMatcher.java
0 → 100644
浏览文件 @
55592615
package
com.ai.cloud.skywalking.plugin.interceptor.matcher
;
import
com.ai.cloud.skywalking.plugin.interceptor.MethodNameMatcher
;
import
net.bytebuddy.matcher.ElementMatcher
;
import
static
net
.
bytebuddy
.
matcher
.
ElementMatchers
.
nameMatches
;
import
static
net
.
bytebuddy
.
matcher
.
ElementMatchers
.
takesArguments
;
public
class
RegexNameMatcher
extends
MethodNameMatcher
{
public
RegexNameMatcher
(
String
methodMatchDescribe
)
{
super
(
methodMatchDescribe
);
}
public
RegexNameMatcher
(
String
methodMatchDescribe
,
int
argNum
)
{
super
(
methodMatchDescribe
,
argNum
);
}
public
RegexNameMatcher
(
String
methodMatchDescribe
,
Class
[]
argTypeArray
)
{
super
(
methodMatchDescribe
,
argTypeArray
);
}
@Override
public
ElementMatcher
builderMatcher
()
{
ElementMatcher
.
Junction
matcher
=
nameMatches
(
getMethodMatchDescribe
());
if
(
getArgTypeArray
()
!=
null
)
{
matcher
.
and
(
takesArguments
(
getArgTypeArray
()));
}
if
(
getArgNum
()
>
-
1
)
{
matcher
.
and
(
takesArguments
(
getArgNum
()));
}
return
matcher
;
}
}
skywalking-api/src/test/java/test/ai/cloud/plugin/TestInterceptorDefine.java
浏览文件 @
55592615
...
...
@@ -3,6 +3,8 @@ package test.ai.cloud.plugin;
import
com.ai.cloud.skywalking.plugin.interceptor.IAroundInterceptor
;
import
com.ai.cloud.skywalking.plugin.interceptor.InterceptPoint
;
import
com.ai.cloud.skywalking.plugin.interceptor.InterceptorDefine
;
import
com.ai.cloud.skywalking.plugin.interceptor.MethodNameMatcher
;
import
com.ai.cloud.skywalking.plugin.interceptor.matcher.FullNameMatcher
;
public
class
TestInterceptorDefine
implements
InterceptorDefine
{
...
...
@@ -12,8 +14,8 @@ public class TestInterceptorDefine implements InterceptorDefine {
}
@Override
public
InterceptPoint
[]
getBeInterceptedMethods
()
{
return
new
InterceptPoint
[]
{
new
InterceptPoint
(
"printabc"
)
};
public
MethodNameMatcher
[]
getBeInterceptedMethods
()
{
return
new
MethodNameMatcher
[]
{
new
FullNameMatcher
(
"printabc"
)
};
}
@Override
...
...
skywalking-sdk-plugin/httpClient-4.x-plugin-dubbox-rest-attachment/src/main/java/org/skywalking/httpClient/v4/plugin/dubbox/rest/attachment/DubboxRestHeadSetterAttachment.java
浏览文件 @
55592615
package
org.skywalking.httpClient.v4.plugin.dubbox.rest.attachment
;
import
com.ai.cloud.skywalking.plugin.interceptor.MethodNameMatcher
;
import
org.skywalking.httpClient.v4.plugin.HttpClientExecuteInterceptor
;
import
com.ai.cloud.skywalking.plugin.interceptor.IAroundInterceptor
;
...
...
@@ -20,7 +21,7 @@ public class DubboxRestHeadSetterAttachment implements InterceptorDefine {
}
@Override
public
InterceptPoint
[]
getBeInterceptedMethods
()
{
public
MethodNameMatcher
[]
getBeInterceptedMethods
()
{
return
null
;
}
...
...
skywalking-sdk-plugin/httpClient-4.x-plugin/src/main/java/org/skywalking/httpClient/v4/plugin/define/AbstractHttpClientPluginDefine.java
浏览文件 @
55592615
package
org.skywalking.httpClient.v4.plugin.define
;
import
com.ai.cloud.skywalking.plugin.interceptor.InterceptPoint
;
import
com.ai.cloud.skywalking.plugin.interceptor.MethodNameMatcher
;
import
com.ai.cloud.skywalking.plugin.interceptor.matcher.FullNameMatcher
;
public
class
AbstractHttpClientPluginDefine
extends
HttpClientPluginDefine
{
...
...
@@ -16,8 +18,8 @@ public class AbstractHttpClientPluginDefine extends HttpClientPluginDefine {
*
*/
@Override
public
InterceptPoint
[]
getBeInterceptedMethods
()
{
return
new
InterceptPoint
[]
{
new
InterceptPoint
(
"doExecute"
)};
public
MethodNameMatcher
[]
getBeInterceptedMethods
()
{
return
new
MethodNameMatcher
[]
{
new
FullNameMatcher
(
"doExecute"
)};
}
}
skywalking-sdk-plugin/httpClient-4.x-plugin/src/main/java/org/skywalking/httpClient/v4/plugin/define/DefaultRequestDirectorPluginDefine.java
浏览文件 @
55592615
package
org.skywalking.httpClient.v4.plugin.define
;
import
com.ai.cloud.skywalking.plugin.interceptor.InterceptPoint
;
import
com.ai.cloud.skywalking.plugin.interceptor.MethodNameMatcher
;
import
com.ai.cloud.skywalking.plugin.interceptor.matcher.FullNameMatcher
;
public
class
DefaultRequestDirectorPluginDefine
extends
HttpClientPluginDefine
{
/**
...
...
@@ -14,9 +16,9 @@ public class DefaultRequestDirectorPluginDefine extends HttpClientPluginDefine {
}
@Override
public
InterceptPoint
[]
getBeInterceptedMethods
()
{
return
new
InterceptPoint
[]
{
new
InterceptPoint
(
"execute"
)};
public
MethodNameMatcher
[]
getBeInterceptedMethods
()
{
return
new
MethodNameMatcher
[]
{
new
FullNameMatcher
(
"execute"
)};
}
}
skywalking-sdk-plugin/httpClient-4.x-plugin/src/main/java/org/skywalking/httpClient/v4/plugin/define/InternalHttpClientPluginDefine.java
浏览文件 @
55592615
package
org.skywalking.httpClient.v4.plugin.define
;
import
com.ai.cloud.skywalking.plugin.interceptor.InterceptPoint
;
import
com.ai.cloud.skywalking.plugin.interceptor.MethodNameMatcher
;
import
com.ai.cloud.skywalking.plugin.interceptor.matcher.FullNameMatcher
;
public
class
InternalHttpClientPluginDefine
extends
HttpClientPluginDefine
{
@Override
public
InterceptPoint
[]
getBeInterceptedMethods
()
{
return
new
InterceptPoint
[]{
new
InterceptPoint
(
"doExecute"
)};
}
@Override
public
String
getBeInterceptedClassName
()
{
return
"org.apache.http.impl.client.InternalHttpClient"
;
}
@Override
public
MethodNameMatcher
[]
getBeInterceptedMethods
()
{
return
new
MethodNameMatcher
[]{
new
FullNameMatcher
(
"doExecute"
)};
}
@Override
public
String
getBeInterceptedClassName
()
{
return
"org.apache.http.impl.client.InternalHttpClient"
;
}
}
skywalking-sdk-plugin/httpClient-4.x-plugin/src/main/java/org/skywalking/httpClient/v4/plugin/define/MinimalHttpClientPluginDefine.java
浏览文件 @
55592615
package
org.skywalking.httpClient.v4.plugin.define
;
import
com.ai.cloud.skywalking.plugin.interceptor.InterceptPoint
;
import
com.ai.cloud.skywalking.plugin.interceptor.MethodNameMatcher
;
import
com.ai.cloud.skywalking.plugin.interceptor.matcher.FullNameMatcher
;
public
class
MinimalHttpClientPluginDefine
extends
HttpClientPluginDefine
{
@Override
public
InterceptPoint
[]
getBeInterceptedMethods
()
{
return
new
InterceptPoint
[]{
new
InterceptPoint
(
"doExecute"
)};
}
@Override
public
String
getBeInterceptedClassName
()
{
return
"org.apache.http.impl.client.MinimalHttpClient"
;
}
@Override
public
MethodNameMatcher
[]
getBeInterceptedMethods
()
{
return
new
MethodNameMatcher
[]{
new
FullNameMatcher
(
"doExecute"
)};
}
@Override
public
String
getBeInterceptedClassName
()
{
return
"org.apache.http.impl.client.MinimalHttpClient"
;
}
}
skywalking-sdk-plugin/jedis-2.x-plugin/src/main/java/org/skywalking/jedis/v2/plugin/define/JedisPluginDefine.java
浏览文件 @
55592615
package
org.skywalking.jedis.v2.plugin.define
;
import
org.skywalking.jedis.v2.plugin.JedisInterceptor
;
import
com.ai.cloud.skywalking.plugin.interceptor.IAroundInterceptor
;
import
com.ai.cloud.skywalking.plugin.interceptor.InterceptPoint
;
import
com.ai.cloud.skywalking.plugin.interceptor.InterceptorDefine
;
import
com.ai.cloud.skywalking.plugin.interceptor.MethodNameMatcher
;
import
com.ai.cloud.skywalking.plugin.interceptor.matcher.ExclusionNameMatcher
;
import
org.skywalking.jedis.v2.plugin.JedisInterceptor
;
public
class
JedisPluginDefine
implements
InterceptorDefine
{
@Override
public
String
getBeInterceptedClassName
()
{
return
"redis.clients.jedis.Jedis"
;
}
@Override
public
String
getBeInterceptedClassName
()
{
return
"redis.clients.jedis.Jedis"
;
}
@Override
public
InterceptPoint
[]
getBeInterceptedMethods
()
{
return
new
InterceptPoint
[]
{
new
InterceptPoint
(
"*"
)
};
}
@Override
public
MethodNameMatcher
[]
getBeInterceptedMethods
()
{
return
new
MethodNameMatcher
[]{
new
ExclusionNameMatcher
(
"set"
),
};
}
@Override
public
IAroundInterceptor
instance
()
{
return
new
JedisInterceptor
();
}
@Override
public
IAroundInterceptor
instance
()
{
return
new
JedisInterceptor
();
}
}
skywalking-sdk-plugin/mysql-plugin/src/main/java/com/ai/cloud/skywalking/plugin/mysql/ConnectionPluginDefine.java
浏览文件 @
55592615
...
...
@@ -3,6 +3,8 @@ package com.ai.cloud.skywalking.plugin.mysql;
import
com.ai.cloud.skywalking.plugin.interceptor.IAroundInterceptor
;
import
com.ai.cloud.skywalking.plugin.interceptor.InterceptPoint
;
import
com.ai.cloud.skywalking.plugin.interceptor.InterceptorDefine
;
import
com.ai.cloud.skywalking.plugin.interceptor.MethodNameMatcher
;
import
com.ai.cloud.skywalking.plugin.interceptor.matcher.FullNameMatcher
;
public
class
ConnectionPluginDefine
implements
InterceptorDefine
{
...
...
@@ -12,12 +14,12 @@ public class ConnectionPluginDefine implements InterceptorDefine {
}
@Override
public
InterceptPoint
[]
getBeInterceptedMethods
()
{
return
new
InterceptPoint
[]
{
new
InterceptPoint
(
"createStatement"
,
2
),
new
InterceptPoint
(
"prepareStatement"
,
3
),
new
InterceptPoint
(
"prepareCall"
,
3
),
new
InterceptPoint
(
"commit"
),
new
InterceptPoint
(
"rollback"
),
new
InterceptPoint
(
"close"
)
};
public
MethodNameMatcher
[]
getBeInterceptedMethods
()
{
return
new
MethodNameMatcher
[]
{
new
FullNameMatcher
(
"createStatement"
,
2
),
new
FullNameMatcher
(
"prepareStatement"
,
3
),
new
FullNameMatcher
(
"prepareCall"
,
3
),
new
FullNameMatcher
(
"commit"
),
new
FullNameMatcher
(
"rollback"
),
new
FullNameMatcher
(
"close"
)
};
}
@Override
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录