Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
阿信在这里
SkyWalking
提交
c6e593f6
S
SkyWalking
项目概览
阿信在这里
/
SkyWalking
与 Fork 源项目一致
Fork自
山不在高_有仙则灵 / 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,发现更多精彩内容 >>
提交
c6e593f6
编写于
1月 11, 2018
作者:
A
ascrutae
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactory MultiClassNameMatch code
上级
97b57786
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
23 addition
and
81 deletion
+23
-81
apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/plugin/match/MultiClassNameMatch.java
...king/apm/agent/core/plugin/match/MultiClassNameMatch.java
+1
-3
apm-sniffer/apm-sdk-plugin/mysql-5.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jdbc/mysql/define/CallableInstrumentation.java
...apm/plugin/jdbc/mysql/define/CallableInstrumentation.java
+1
-1
apm-sniffer/apm-sdk-plugin/mysql-5.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jdbc/mysql/define/DriverInstrumentation.java
...g/apm/plugin/jdbc/mysql/define/DriverInstrumentation.java
+1
-1
apm-sniffer/apm-sdk-plugin/mysql-5.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jdbc/mysql/define/Mysql5xConnectionInstrumentation.java
...n/jdbc/mysql/define/Mysql5xConnectionInstrumentation.java
+1
-1
apm-sniffer/apm-sdk-plugin/mysql-5.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jdbc/mysql/define/PreparedStatementInstrumentation.java
...n/jdbc/mysql/define/PreparedStatementInstrumentation.java
+1
-1
apm-sniffer/apm-sdk-plugin/mysql-5.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jdbc/mysql/define/StatementInstrumentation.java
...pm/plugin/jdbc/mysql/define/StatementInstrumentation.java
+1
-1
apm-sniffer/apm-sdk-plugin/postgresql-8.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jdbc/postgresql/define/AbstractJdbc2StatementInstrumentation.java
...tgresql/define/AbstractJdbc2StatementInstrumentation.java
+16
-4
apm-sniffer/apm-sdk-plugin/postgresql-8.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jdbc/postgresql/define/ConnectionInstrumentation.java
...gin/jdbc/postgresql/define/ConnectionInstrumentation.java
+1
-1
apm-sniffer/apm-sdk-plugin/postgresql-8.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jdbc/postgresql/define/MultiClassNameMatch.java
...pm/plugin/jdbc/postgresql/define/MultiClassNameMatch.java
+0
-68
未找到文件。
apm-sniffer/apm-
sdk-plugin/mysql-5.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jdbc/mysql/define
/MultiClassNameMatch.java
→
apm-sniffer/apm-
agent-core/src/main/java/org/apache/skywalking/apm/agent/core/plugin/match
/MultiClassNameMatch.java
浏览文件 @
c6e593f6
...
...
@@ -17,14 +17,12 @@
*/
package
org.apache.skywalking.apm.
plugin.jdbc.mysql.define
;
package
org.apache.skywalking.apm.
agent.core.plugin.match
;
import
java.util.Arrays
;
import
java.util.List
;
import
net.bytebuddy.description.type.TypeDescription
;
import
net.bytebuddy.matcher.ElementMatcher
;
import
org.apache.skywalking.apm.agent.core.plugin.match.ClassMatch
;
import
org.apache.skywalking.apm.agent.core.plugin.match.IndirectMatch
;
import
static
net
.
bytebuddy
.
matcher
.
ElementMatchers
.
named
;
...
...
apm-sniffer/apm-sdk-plugin/mysql-5.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jdbc/mysql/define/CallableInstrumentation.java
浏览文件 @
c6e593f6
...
...
@@ -27,7 +27,7 @@ import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassInst
import
org.apache.skywalking.apm.agent.core.plugin.match.ClassMatch
;
import
static
net
.
bytebuddy
.
matcher
.
ElementMatchers
.
named
;
import
static
org
.
apache
.
skywalking
.
apm
.
plugin
.
jdbc
.
mysql
.
define
.
MultiClassNameMatch
.
byMultiClassMatch
;
import
static
org
.
apache
.
skywalking
.
apm
.
agent
.
core
.
plugin
.
match
.
MultiClassNameMatch
.
byMultiClassMatch
;
/**
* {@link CallableInstrumentation} define that the mysql-2.x plugin intercepts the following methods in the {@link
...
...
apm-sniffer/apm-sdk-plugin/mysql-5.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jdbc/mysql/define/DriverInstrumentation.java
浏览文件 @
c6e593f6
...
...
@@ -22,7 +22,7 @@ package org.apache.skywalking.apm.plugin.jdbc.mysql.define;
import
org.apache.skywalking.apm.plugin.jdbc.define.AbstractDriverInstrumentation
;
import
org.apache.skywalking.apm.agent.core.plugin.match.ClassMatch
;
import
static
org
.
apache
.
skywalking
.
apm
.
plugin
.
jdbc
.
mysql
.
define
.
MultiClassNameMatch
.
byMultiClassMatch
;
import
static
org
.
apache
.
skywalking
.
apm
.
agent
.
core
.
plugin
.
match
.
MultiClassNameMatch
.
byMultiClassMatch
;
/**
* {@link DriverInstrumentation} presents that skywalking intercepts {@link com.mysql.jdbc.Driver}.
...
...
apm-sniffer/apm-sdk-plugin/mysql-5.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jdbc/mysql/define/Mysql5xConnectionInstrumentation.java
浏览文件 @
c6e593f6
...
...
@@ -21,7 +21,7 @@ package org.apache.skywalking.apm.plugin.jdbc.mysql.define;
import
org.apache.skywalking.apm.agent.core.plugin.match.ClassMatch
;
import
static
org
.
apache
.
skywalking
.
apm
.
plugin
.
jdbc
.
mysql
.
define
.
MultiClassNameMatch
.
byMultiClassMatch
;
import
static
org
.
apache
.
skywalking
.
apm
.
agent
.
core
.
plugin
.
match
.
MultiClassNameMatch
.
byMultiClassMatch
;
/**
* {@link Mysql5xConnectionInstrumentation } interceptor {@link com.mysql.cj.jdbc.ConnectionImpl} and
...
...
apm-sniffer/apm-sdk-plugin/mysql-5.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jdbc/mysql/define/PreparedStatementInstrumentation.java
浏览文件 @
c6e593f6
...
...
@@ -27,7 +27,7 @@ import org.apache.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterc
import
org.apache.skywalking.apm.agent.core.plugin.match.ClassMatch
;
import
static
net
.
bytebuddy
.
matcher
.
ElementMatchers
.
named
;
import
static
org
.
apache
.
skywalking
.
apm
.
plugin
.
jdbc
.
mysql
.
define
.
MultiClassNameMatch
.
byMultiClassMatch
;
import
static
org
.
apache
.
skywalking
.
apm
.
agent
.
core
.
plugin
.
match
.
MultiClassNameMatch
.
byMultiClassMatch
;
/**
* {@link PreparedStatementInstrumentation} define that the mysql-2.x plugin intercepts the following methods in the
...
...
apm-sniffer/apm-sdk-plugin/mysql-5.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jdbc/mysql/define/StatementInstrumentation.java
浏览文件 @
c6e593f6
...
...
@@ -27,7 +27,7 @@ import org.apache.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterc
import
org.apache.skywalking.apm.agent.core.plugin.match.ClassMatch
;
import
static
net
.
bytebuddy
.
matcher
.
ElementMatchers
.
named
;
import
static
org
.
apache
.
skywalking
.
apm
.
plugin
.
jdbc
.
mysql
.
define
.
MultiClassNameMatch
.
byMultiClassMatch
;
import
static
org
.
apache
.
skywalking
.
apm
.
agent
.
core
.
plugin
.
match
.
MultiClassNameMatch
.
byMultiClassMatch
;
/**
* {@link StatementInstrumentation} intercepts the following methods in the {@link
...
...
apm-sniffer/apm-sdk-plugin/postgresql-8.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jdbc/postgresql/define/AbstractJdbc2StatementInstrumentation.java
浏览文件 @
c6e593f6
...
...
@@ -31,6 +31,7 @@ import static net.bytebuddy.matcher.ElementMatchers.named;
import
static
net
.
bytebuddy
.
matcher
.
ElementMatchers
.
takesArguments
;
import
static
org
.
apache
.
skywalking
.
apm
.
agent
.
core
.
plugin
.
match
.
NameMatch
.
byName
;
import
static
org
.
apache
.
skywalking
.
apm
.
plugin
.
jdbc
.
postgresql
.
Variables
.
PG_PREPARED_STATEMENT_EXECUTE_METHOD_INTERCEPTOR
;
import
static
org
.
apache
.
skywalking
.
apm
.
plugin
.
jdbc
.
postgresql
.
Variables
.
PG_STATEMENT_EXECUTE_METHOD_INTERCEPTOR
;
/**
* {@link AbstractJdbc2StatementInstrumentation} intercept the following methods that the class which extend {@link
...
...
@@ -61,16 +62,27 @@ public class AbstractJdbc2StatementInstrumentation extends ClassInstanceMethodsE
new
InstanceMethodsInterceptPoint
()
{
@Override
public
ElementMatcher
<
MethodDescription
>
getMethodsMatcher
()
{
return
named
(
"execute"
).
and
(
takesArguments
(
0
))
.
or
(
named
(
"execute"
).
and
(
takesArguments
(
1
)))
.
or
(
named
(
"executeBatch"
))
.
or
(
named
(
"executeQuery"
).
and
(
takesArguments
(
0
)))
.
or
(
named
(
"executeUpdate"
).
and
(
takesArguments
(
0
)));
}
@Override
public
String
getMethodsInterceptor
()
{
return
PG_PREPARED_STATEMENT_EXECUTE_METHOD_INTERCEPTOR
;
}
@Override
public
boolean
isOverrideArgs
()
{
return
false
;
}
},
new
InstanceMethodsInterceptPoint
()
{
@Override
public
ElementMatcher
<
MethodDescription
>
getMethodsMatcher
()
{
return
named
(
"execute"
).
and
(
takesArguments
(
1
))
.
or
(
named
(
"executeQuery"
).
and
(
takesArguments
(
1
)))
.
or
(
named
(
"executeUpdate"
).
and
(
takesArguments
(
0
)))
.
or
(
named
(
"executeUpdate"
).
and
(
takesArguments
(
1
)));
}
@Override
public
String
getMethodsInterceptor
()
{
return
PG_
PREPARED_
STATEMENT_EXECUTE_METHOD_INTERCEPTOR
;
return
PG_STATEMENT_EXECUTE_METHOD_INTERCEPTOR
;
}
@Override
public
boolean
isOverrideArgs
()
{
...
...
apm-sniffer/apm-sdk-plugin/postgresql-8.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jdbc/postgresql/define/ConnectionInstrumentation.java
浏览文件 @
c6e593f6
...
...
@@ -29,7 +29,7 @@ import org.apache.skywalking.apm.agent.core.plugin.match.ClassMatch;
import
static
net
.
bytebuddy
.
matcher
.
ElementMatchers
.
named
;
import
static
net
.
bytebuddy
.
matcher
.
ElementMatchers
.
takesArguments
;
import
static
org
.
apache
.
skywalking
.
apm
.
agent
.
core
.
plugin
.
bytebuddy
.
ArgumentTypeNameMatch
.
takesArgumentWithType
;
import
static
org
.
apache
.
skywalking
.
apm
.
plugin
.
jdbc
.
postgresql
.
define
.
MultiClassNameMatch
.
byMultiClassMatch
;
import
static
org
.
apache
.
skywalking
.
apm
.
agent
.
core
.
plugin
.
match
.
MultiClassNameMatch
.
byMultiClassMatch
;
/**
* {@link ConnectionInstrumentation} intercept the following methods that the class which extend {@link
...
...
apm-sniffer/apm-sdk-plugin/postgresql-8.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jdbc/postgresql/define/MultiClassNameMatch.java
已删除
100644 → 0
浏览文件 @
97b57786
/*
* 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.jdbc.postgresql.define
;
import
java.util.Arrays
;
import
java.util.List
;
import
net.bytebuddy.description.type.TypeDescription
;
import
net.bytebuddy.matcher.ElementMatcher
;
import
org.apache.skywalking.apm.agent.core.plugin.match.ClassMatch
;
import
org.apache.skywalking.apm.agent.core.plugin.match.IndirectMatch
;
import
static
net
.
bytebuddy
.
matcher
.
ElementMatchers
.
named
;
/**
* Match class with a given set of classes.
*
* @author zhangxin
*/
public
class
MultiClassNameMatch
implements
IndirectMatch
{
private
List
<
String
>
matchClassNames
;
private
MultiClassNameMatch
(
String
[]
classNames
)
{
if
(
classNames
==
null
||
classNames
.
length
==
0
)
{
throw
new
IllegalArgumentException
(
"match class names is null"
);
}
this
.
matchClassNames
=
Arrays
.
asList
(
classNames
);
}
@Override
public
ElementMatcher
.
Junction
buildJunction
()
{
ElementMatcher
.
Junction
junction
=
null
;
for
(
String
name
:
matchClassNames
)
{
if
(
junction
==
null
)
{
junction
=
named
(
name
);
}
else
{
junction
=
junction
.
or
(
named
(
name
));
}
}
return
junction
;
}
@Override
public
boolean
isMatch
(
TypeDescription
typeDescription
)
{
return
matchClassNames
.
contains
(
typeDescription
.
getTypeName
());
}
public
static
ClassMatch
byMultiClassMatch
(
String
...
classNames
)
{
return
new
MultiClassNameMatch
(
classNames
);
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录