Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
killuaz丶x
SkyWalking
提交
9946a71d
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,发现更多精彩内容 >>
提交
9946a71d
编写于
11月 01, 2017
作者:
A
ascrutae
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
change mysql plugin module name
上级
1d1c81f4
变更
22
显示空白变更内容
内联
并排
Showing
22 changed file
with
52 addition
and
104 deletion
+52
-104
apm-sniffer/apm-sdk-plugin/jdbc-commons/src/main/java/org/skywalking/apm/plugin/jdbc/ConnectionServiceMethodInterceptor.java
...g/apm/plugin/jdbc/ConnectionServiceMethodInterceptor.java
+5
-2
apm-sniffer/apm-sdk-plugin/mysql-2.x-plugin/src/main/java/org/skywalking/apm/plugin/jdbc/mysql/define/JDBC42PreparedStatementInstrumentation.java
.../mysql/define/JDBC42PreparedStatementInstrumentation.java
+0
-36
apm-sniffer/apm-sdk-plugin/mysql-2.x-plugin/src/main/java/org/skywalking/apm/plugin/jdbc/mysql/define/PreparedStatementInstrumentation.java
...n/jdbc/mysql/define/PreparedStatementInstrumentation.java
+0
-38
apm-sniffer/apm-sdk-plugin/mysql-2.x-plugin/src/main/resources/skywalking-plugin.def
...mysql-2.x-plugin/src/main/resources/skywalking-plugin.def
+0
-6
apm-sniffer/apm-sdk-plugin/mysql-5.x-plugin/pom.xml
apm-sniffer/apm-sdk-plugin/mysql-5.x-plugin/pom.xml
+3
-3
apm-sniffer/apm-sdk-plugin/mysql-5.x-plugin/src/main/java/org/skywalking/apm/plugin/jdbc/mysql/CreateCallableStatementInterceptor.java
...plugin/jdbc/mysql/CreateCallableStatementInterceptor.java
+0
-0
apm-sniffer/apm-sdk-plugin/mysql-5.x-plugin/src/main/java/org/skywalking/apm/plugin/jdbc/mysql/CreatePreparedStatementInterceptor.java
...plugin/jdbc/mysql/CreatePreparedStatementInterceptor.java
+0
-0
apm-sniffer/apm-sdk-plugin/mysql-5.x-plugin/src/main/java/org/skywalking/apm/plugin/jdbc/mysql/CreateStatementInterceptor.java
...ing/apm/plugin/jdbc/mysql/CreateStatementInterceptor.java
+0
-0
apm-sniffer/apm-sdk-plugin/mysql-5.x-plugin/src/main/java/org/skywalking/apm/plugin/jdbc/mysql/StatementExecuteMethodsInterceptor.java
...plugin/jdbc/mysql/StatementExecuteMethodsInterceptor.java
+7
-0
apm-sniffer/apm-sdk-plugin/mysql-5.x-plugin/src/main/java/org/skywalking/apm/plugin/jdbc/mysql/define/CallableInstrumentation.java
...apm/plugin/jdbc/mysql/define/CallableInstrumentation.java
+6
-4
apm-sniffer/apm-sdk-plugin/mysql-5.x-plugin/src/main/java/org/skywalking/apm/plugin/jdbc/mysql/define/ConnectionInstrumentation.java
...m/plugin/jdbc/mysql/define/ConnectionInstrumentation.java
+2
-2
apm-sniffer/apm-sdk-plugin/mysql-5.x-plugin/src/main/java/org/skywalking/apm/plugin/jdbc/mysql/define/DriverInstrumentation.java
...g/apm/plugin/jdbc/mysql/define/DriverInstrumentation.java
+2
-2
apm-sniffer/apm-sdk-plugin/mysql-5.x-plugin/src/main/java/org/skywalking/apm/plugin/jdbc/mysql/define/MultiClassNameMatch.java
...ing/apm/plugin/jdbc/mysql/define/MultiClassNameMatch.java
+2
-2
apm-sniffer/apm-sdk-plugin/mysql-5.x-plugin/src/main/java/org/skywalking/apm/plugin/jdbc/mysql/define/PreparedStatementInstrumentation.java
...n/jdbc/mysql/define/PreparedStatementInstrumentation.java
+13
-3
apm-sniffer/apm-sdk-plugin/mysql-5.x-plugin/src/main/java/org/skywalking/apm/plugin/jdbc/mysql/define/StatementEnhanceInfos.java
...g/apm/plugin/jdbc/mysql/define/StatementEnhanceInfos.java
+0
-0
apm-sniffer/apm-sdk-plugin/mysql-5.x-plugin/src/main/java/org/skywalking/apm/plugin/jdbc/mysql/define/StatementInstrumentation.java
...pm/plugin/jdbc/mysql/define/StatementInstrumentation.java
+6
-5
apm-sniffer/apm-sdk-plugin/mysql-5.x-plugin/src/main/resources/skywalking-plugin.def
...mysql-5.x-plugin/src/main/resources/skywalking-plugin.def
+5
-0
apm-sniffer/apm-sdk-plugin/mysql-5.x-plugin/src/test/java/org/skywalking/apm/plugin/jdbc/mysql/CreateCallableStatementInterceptorTest.java
...in/jdbc/mysql/CreateCallableStatementInterceptorTest.java
+0
-0
apm-sniffer/apm-sdk-plugin/mysql-5.x-plugin/src/test/java/org/skywalking/apm/plugin/jdbc/mysql/CreatePreparedStatementInterceptorTest.java
...in/jdbc/mysql/CreatePreparedStatementInterceptorTest.java
+0
-0
apm-sniffer/apm-sdk-plugin/mysql-5.x-plugin/src/test/java/org/skywalking/apm/plugin/jdbc/mysql/CreateStatementInterceptorTest.java
...apm/plugin/jdbc/mysql/CreateStatementInterceptorTest.java
+0
-0
apm-sniffer/apm-sdk-plugin/mysql-5.x-plugin/src/test/java/org/skywalking/apm/plugin/jdbc/mysql/StatementExecuteMethodsInterceptorTest.java
...in/jdbc/mysql/StatementExecuteMethodsInterceptorTest.java
+0
-0
apm-sniffer/apm-sdk-plugin/pom.xml
apm-sniffer/apm-sdk-plugin/pom.xml
+1
-1
未找到文件。
apm-sniffer/apm-sdk-plugin/jdbc-commons/src/main/java/org/skywalking/apm/plugin/jdbc/ConnectionServiceMethodInterceptor.java
浏览文件 @
9946a71d
...
@@ -29,8 +29,11 @@ import org.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptR
...
@@ -29,8 +29,11 @@ import org.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptR
import
org.skywalking.apm.plugin.jdbc.trace.ConnectionInfo
;
import
org.skywalking.apm.plugin.jdbc.trace.ConnectionInfo
;
/**
/**
* {@link ConnectionServiceMethodInterceptor} create an exit span when the client call the following methods in the
* {@link ConnectionServiceMethodInterceptor} create an exit span when the following methods execute:
* class that extend {@link java.sql.Connection}. 1. close 2. rollback 3. releaseSavepoint 4. commit
* 1. close
* 2. rollback
* 3. releaseSavepoint
* 4. commit
*
*
* @author zhangxin
* @author zhangxin
*/
*/
...
...
apm-sniffer/apm-sdk-plugin/mysql-2.x-plugin/src/main/java/org/skywalking/apm/plugin/jdbc/mysql/define/JDBC42PreparedStatementInstrumentation.java
已删除
100644 → 0
浏览文件 @
1d1c81f4
/*
* Copyright 2017, OpenSkywalking Organization All rights reserved.
*
* Licensed 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.
*
* Project repository: https://github.com/OpenSkywalking/skywalking
*/
package
org.skywalking.apm.plugin.jdbc.mysql.define
;
import
org.skywalking.apm.agent.core.plugin.match.ClassMatch
;
import
static
org
.
skywalking
.
apm
.
agent
.
core
.
plugin
.
match
.
NameMatch
.
byName
;
/**
* {@link JDBC42PreparedStatementInstrumentation} intercepts {@link com.mysql.jdbc.JDBC42PreparedStatement} class.
*
* @author zhangxin
*/
public
class
JDBC42PreparedStatementInstrumentation
extends
AbstractPreparedStatementInstrumentation
{
private
static
final
String
ENHANCE_CLASS
=
"com.mysql.jdbc.JDBC42PreparedStatement"
;
@Override
protected
ClassMatch
enhanceClass
()
{
return
byName
(
ENHANCE_CLASS
);
}
}
apm-sniffer/apm-sdk-plugin/mysql-2.x-plugin/src/main/java/org/skywalking/apm/plugin/jdbc/mysql/define/PreparedStatementInstrumentation.java
已删除
100644 → 0
浏览文件 @
1d1c81f4
/*
* Copyright 2017, OpenSkywalking Organization All rights reserved.
*
* Licensed 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.
*
* Project repository: https://github.com/OpenSkywalking/skywalking
*/
package
org.skywalking.apm.plugin.jdbc.mysql.define
;
import
org.skywalking.apm.agent.core.plugin.match.ClassMatch
;
import
static
org
.
skywalking
.
apm
.
plugin
.
jdbc
.
mysql
.
define
.
MultiClassNameMatch
.
byMultiClassMath
;
/**
* {@link JDBC42PreparedStatementInstrumentation} intercepts {@link com.mysql.jdbc.PreparedStatement} class.
*
* @author zhangxin
*/
public
class
PreparedStatementInstrumentation
extends
AbstractPreparedStatementInstrumentation
{
private
static
final
String
ENHANCE_CLASS
=
"com.mysql.jdbc.PreparedStatement"
;
@Override
protected
ClassMatch
enhanceClass
()
{
return
byMultiClassMath
(
ENHANCE_CLASS
,
"com.mysql.cj.jdbc.PreparedStatement"
);
}
}
apm-sniffer/apm-sdk-plugin/mysql-2.x-plugin/src/main/resources/skywalking-plugin.def
已删除
100644 → 0
浏览文件 @
1d1c81f4
mysql=org.skywalking.apm.plugin.jdbc.mysql.define.DriverInstrumentation
mysql=org.skywalking.apm.plugin.jdbc.mysql.define.ConnectionInstrumentation
mysql=org.skywalking.apm.plugin.jdbc.mysql.define.CallableInstrumentation
mysql=org.skywalking.apm.plugin.jdbc.mysql.define.PreparedStatementInstrumentation
mysql=org.skywalking.apm.plugin.jdbc.mysql.define.JDBC42PreparedStatementInstrumentation
mysql=org.skywalking.apm.plugin.jdbc.mysql.define.StatementInstrumentation
apm-sniffer/apm-sdk-plugin/mysql-
2
.x-plugin/pom.xml
→
apm-sniffer/apm-sdk-plugin/mysql-
5
.x-plugin/pom.xml
浏览文件 @
9946a71d
...
@@ -25,10 +25,10 @@
...
@@ -25,10 +25,10 @@
</parent>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
apm-mysql-
2
.x-plugin
</artifactId>
<artifactId>
apm-mysql-
5
.x-plugin
</artifactId>
<packaging>
jar
</packaging>
<packaging>
jar
</packaging>
<name>
mysql-
2
.x-plugin
</name>
<name>
mysql-
5
.x-plugin
</name>
<url>
http://maven.apache.org
</url>
<url>
http://maven.apache.org
</url>
<properties>
<properties>
...
@@ -45,7 +45,7 @@
...
@@ -45,7 +45,7 @@
<dependency>
<dependency>
<groupId>
mysql
</groupId>
<groupId>
mysql
</groupId>
<artifactId>
mysql-connector-java
</artifactId>
<artifactId>
mysql-connector-java
</artifactId>
<version>
[
2.0.14
,6.0.6]
</version>
<version>
[
5.1.22
,6.0.6]
</version>
<scope>
provided
</scope>
<scope>
provided
</scope>
</dependency>
</dependency>
<dependency>
<dependency>
...
...
apm-sniffer/apm-sdk-plugin/mysql-
2
.x-plugin/src/main/java/org/skywalking/apm/plugin/jdbc/mysql/CreateCallableStatementInterceptor.java
→
apm-sniffer/apm-sdk-plugin/mysql-
5
.x-plugin/src/main/java/org/skywalking/apm/plugin/jdbc/mysql/CreateCallableStatementInterceptor.java
浏览文件 @
9946a71d
文件已移动
apm-sniffer/apm-sdk-plugin/mysql-
2
.x-plugin/src/main/java/org/skywalking/apm/plugin/jdbc/mysql/CreatePreparedStatementInterceptor.java
→
apm-sniffer/apm-sdk-plugin/mysql-
5
.x-plugin/src/main/java/org/skywalking/apm/plugin/jdbc/mysql/CreatePreparedStatementInterceptor.java
浏览文件 @
9946a71d
文件已移动
apm-sniffer/apm-sdk-plugin/mysql-
2
.x-plugin/src/main/java/org/skywalking/apm/plugin/jdbc/mysql/CreateStatementInterceptor.java
→
apm-sniffer/apm-sdk-plugin/mysql-
5
.x-plugin/src/main/java/org/skywalking/apm/plugin/jdbc/mysql/CreateStatementInterceptor.java
浏览文件 @
9946a71d
文件已移动
apm-sniffer/apm-sdk-plugin/mysql-
2
.x-plugin/src/main/java/org/skywalking/apm/plugin/jdbc/mysql/StatementExecuteMethodsInterceptor.java
→
apm-sniffer/apm-sdk-plugin/mysql-
5
.x-plugin/src/main/java/org/skywalking/apm/plugin/jdbc/mysql/StatementExecuteMethodsInterceptor.java
浏览文件 @
9946a71d
...
@@ -41,6 +41,13 @@ public class StatementExecuteMethodsInterceptor implements InstanceMethodsAround
...
@@ -41,6 +41,13 @@ public class StatementExecuteMethodsInterceptor implements InstanceMethodsAround
MethodInterceptResult
result
)
throws
Throwable
{
MethodInterceptResult
result
)
throws
Throwable
{
StatementEnhanceInfos
cacheObject
=
(
StatementEnhanceInfos
)
objInst
.
getSkyWalkingDynamicField
();
StatementEnhanceInfos
cacheObject
=
(
StatementEnhanceInfos
)
objInst
.
getSkyWalkingDynamicField
();
ConnectionInfo
connectInfo
=
cacheObject
.
getConnectionInfo
();
ConnectionInfo
connectInfo
=
cacheObject
.
getConnectionInfo
();
/**
* To protected the code occur NullPointException. because mysql execute system sql when constructor method in
* {@link com.mysql.jdbc.ConnectionImpl} class executed. but the interceptor set the connection Info after
* the constructor method executed.
*
* @see org.skywalking.apm.plugin.jdbc.JDBCDriverInterceptor#afterMethod(EnhancedInstance, Method, Object[], Class[], Object)
*/
if
(
connectInfo
!=
null
)
{
if
(
connectInfo
!=
null
)
{
AbstractSpan
span
=
ContextManager
.
createExitSpan
(
buildOperationName
(
connectInfo
,
method
.
getName
(),
cacheObject
.
getStatementName
()),
connectInfo
.
getDatabasePeer
());
AbstractSpan
span
=
ContextManager
.
createExitSpan
(
buildOperationName
(
connectInfo
,
method
.
getName
(),
cacheObject
.
getStatementName
()),
connectInfo
.
getDatabasePeer
());
...
...
apm-sniffer/apm-sdk-plugin/mysql-
2
.x-plugin/src/main/java/org/skywalking/apm/plugin/jdbc/mysql/define/CallableInstrumentation.java
→
apm-sniffer/apm-sdk-plugin/mysql-
5
.x-plugin/src/main/java/org/skywalking/apm/plugin/jdbc/mysql/define/CallableInstrumentation.java
浏览文件 @
9946a71d
...
@@ -26,12 +26,14 @@ import org.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassInstanceMet
...
@@ -26,12 +26,14 @@ import org.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassInstanceMet
import
org.skywalking.apm.agent.core.plugin.match.ClassMatch
;
import
org.skywalking.apm.agent.core.plugin.match.ClassMatch
;
import
static
net
.
bytebuddy
.
matcher
.
ElementMatchers
.
named
;
import
static
net
.
bytebuddy
.
matcher
.
ElementMatchers
.
named
;
import
static
org
.
skywalking
.
apm
.
plugin
.
jdbc
.
mysql
.
define
.
MultiClassNameMatch
.
byMultiClassMath
;
import
static
org
.
skywalking
.
apm
.
plugin
.
jdbc
.
mysql
.
define
.
MultiClassNameMatch
.
byMultiClassMat
c
h
;
/**
/**
* {@link CallableInstrumentation} define that the mysql-2.x plugin intercepts the following methods in the {@link
* {@link CallableInstrumentation} define that the mysql-2.x plugin intercepts the following methods in the {@link
* com.mysql.jdbc.CallableStatement} by {@link org.skywalking.apm.plugin.jdbc.mysql.CallableStatementInterceptor}. 1.
* com.mysql.jdbc.CallableStatement} by {@link org.skywalking.apm.plugin.jdbc.mysql.CallableStatementInterceptor}:
* execute <br/> 2. executeQuery <br/> 3. executeUpdate <br/>
* 1. execute <br/>
* 2. executeQuery <br/>
* 3. executeUpdate <br/>
*
*
* @author zhangxin
* @author zhangxin
*/
*/
...
@@ -64,6 +66,6 @@ public class CallableInstrumentation extends ClassInstanceMethodsEnhancePluginDe
...
@@ -64,6 +66,6 @@ public class CallableInstrumentation extends ClassInstanceMethodsEnhancePluginDe
}
}
@Override
protected
ClassMatch
enhanceClass
()
{
@Override
protected
ClassMatch
enhanceClass
()
{
return
byMultiClassMath
(
ENHANCE_CLASS
,
"com.mysql.jdbc.cj.CallableStatement"
);
return
byMultiClassMat
c
h
(
ENHANCE_CLASS
,
"com.mysql.jdbc.cj.CallableStatement"
);
}
}
}
}
apm-sniffer/apm-sdk-plugin/mysql-
2
.x-plugin/src/main/java/org/skywalking/apm/plugin/jdbc/mysql/define/ConnectionInstrumentation.java
→
apm-sniffer/apm-sdk-plugin/mysql-
5
.x-plugin/src/main/java/org/skywalking/apm/plugin/jdbc/mysql/define/ConnectionInstrumentation.java
浏览文件 @
9946a71d
...
@@ -35,7 +35,7 @@ import static org.skywalking.apm.plugin.jdbc.define.Constants.PREPARE_STATEMENT_
...
@@ -35,7 +35,7 @@ import static org.skywalking.apm.plugin.jdbc.define.Constants.PREPARE_STATEMENT_
import
static
org
.
skywalking
.
apm
.
plugin
.
jdbc
.
define
.
Constants
.
RELEASE_SAVE_POINT_METHOD_NAME
;
import
static
org
.
skywalking
.
apm
.
plugin
.
jdbc
.
define
.
Constants
.
RELEASE_SAVE_POINT_METHOD_NAME
;
import
static
org
.
skywalking
.
apm
.
plugin
.
jdbc
.
define
.
Constants
.
ROLLBACK_METHOD_NAME
;
import
static
org
.
skywalking
.
apm
.
plugin
.
jdbc
.
define
.
Constants
.
ROLLBACK_METHOD_NAME
;
import
static
org
.
skywalking
.
apm
.
plugin
.
jdbc
.
define
.
Constants
.
SERVICE_METHOD_INTERCEPT_CLASS
;
import
static
org
.
skywalking
.
apm
.
plugin
.
jdbc
.
define
.
Constants
.
SERVICE_METHOD_INTERCEPT_CLASS
;
import
static
org
.
skywalking
.
apm
.
plugin
.
jdbc
.
mysql
.
define
.
MultiClassNameMatch
.
byMultiClassMath
;
import
static
org
.
skywalking
.
apm
.
plugin
.
jdbc
.
mysql
.
define
.
MultiClassNameMatch
.
byMultiClassMat
c
h
;
/**
/**
* {@link ConnectionInstrumentation} intercepts the following methods that the class which extend {@link
* {@link ConnectionInstrumentation} intercepts the following methods that the class which extend {@link
...
@@ -115,6 +115,6 @@ public class ConnectionInstrumentation extends ClassInstanceMethodsEnhancePlugin
...
@@ -115,6 +115,6 @@ public class ConnectionInstrumentation extends ClassInstanceMethodsEnhancePlugin
}
}
@Override
protected
ClassMatch
enhanceClass
()
{
@Override
protected
ClassMatch
enhanceClass
()
{
return
byMultiClassMath
(
ENHANCE_CLASS
,
"com.mysql.cj.jdbc.ConnectionImpl"
);
return
byMultiClassMat
c
h
(
ENHANCE_CLASS
,
"com.mysql.cj.jdbc.ConnectionImpl"
);
}
}
}
}
apm-sniffer/apm-sdk-plugin/mysql-
2
.x-plugin/src/main/java/org/skywalking/apm/plugin/jdbc/mysql/define/DriverInstrumentation.java
→
apm-sniffer/apm-sdk-plugin/mysql-
5
.x-plugin/src/main/java/org/skywalking/apm/plugin/jdbc/mysql/define/DriverInstrumentation.java
浏览文件 @
9946a71d
...
@@ -21,7 +21,7 @@ package org.skywalking.apm.plugin.jdbc.mysql.define;
...
@@ -21,7 +21,7 @@ package org.skywalking.apm.plugin.jdbc.mysql.define;
import
org.skywalking.apm.agent.core.plugin.match.ClassMatch
;
import
org.skywalking.apm.agent.core.plugin.match.ClassMatch
;
import
org.skywalking.apm.plugin.jdbc.define.AbstractDriverInstrumentation
;
import
org.skywalking.apm.plugin.jdbc.define.AbstractDriverInstrumentation
;
import
static
org
.
skywalking
.
apm
.
plugin
.
jdbc
.
mysql
.
define
.
MultiClassNameMatch
.
byMultiClassMath
;
import
static
org
.
skywalking
.
apm
.
plugin
.
jdbc
.
mysql
.
define
.
MultiClassNameMatch
.
byMultiClassMat
c
h
;
/**
/**
* {@link DriverInstrumentation} presents that skywalking intercepts {@link com.mysql.jdbc.Driver}.
* {@link DriverInstrumentation} presents that skywalking intercepts {@link com.mysql.jdbc.Driver}.
...
@@ -31,6 +31,6 @@ import static org.skywalking.apm.plugin.jdbc.mysql.define.MultiClassNameMatch.by
...
@@ -31,6 +31,6 @@ import static org.skywalking.apm.plugin.jdbc.mysql.define.MultiClassNameMatch.by
public
class
DriverInstrumentation
extends
AbstractDriverInstrumentation
{
public
class
DriverInstrumentation
extends
AbstractDriverInstrumentation
{
@Override
@Override
protected
ClassMatch
enhanceClass
()
{
protected
ClassMatch
enhanceClass
()
{
return
byMultiClassMath
(
"com.mysql.jdbc.Driver"
,
"com.mysql.cj.jdbc.Driver"
);
return
byMultiClassMat
c
h
(
"com.mysql.jdbc.Driver"
,
"com.mysql.cj.jdbc.Driver"
);
}
}
}
}
apm-sniffer/apm-sdk-plugin/mysql-
2
.x-plugin/src/main/java/org/skywalking/apm/plugin/jdbc/mysql/define/MultiClassNameMatch.java
→
apm-sniffer/apm-sdk-plugin/mysql-
5
.x-plugin/src/main/java/org/skywalking/apm/plugin/jdbc/mysql/define/MultiClassNameMatch.java
浏览文件 @
9946a71d
...
@@ -28,7 +28,7 @@ import org.skywalking.apm.agent.core.plugin.match.IndirectMatch;
...
@@ -28,7 +28,7 @@ import org.skywalking.apm.agent.core.plugin.match.IndirectMatch;
import
static
net
.
bytebuddy
.
matcher
.
ElementMatchers
.
named
;
import
static
net
.
bytebuddy
.
matcher
.
ElementMatchers
.
named
;
/**
/**
* Match
multiple classes name with an explicit class name
.
* Match
class with a given set of classes
.
*
*
* @author zhangxin
* @author zhangxin
*/
*/
...
@@ -61,7 +61,7 @@ public class MultiClassNameMatch implements IndirectMatch {
...
@@ -61,7 +61,7 @@ public class MultiClassNameMatch implements IndirectMatch {
return
matchClassNames
.
contains
(
typeDescription
.
getTypeName
());
return
matchClassNames
.
contains
(
typeDescription
.
getTypeName
());
}
}
public
static
ClassMatch
byMultiClassMath
(
String
...
classNames
)
{
public
static
ClassMatch
byMultiClassMat
c
h
(
String
...
classNames
)
{
return
new
MultiClassNameMatch
(
classNames
);
return
new
MultiClassNameMatch
(
classNames
);
}
}
}
}
apm-sniffer/apm-sdk-plugin/mysql-
2.x-plugin/src/main/java/org/skywalking/apm/plugin/jdbc/mysql/define/Abstract
PreparedStatementInstrumentation.java
→
apm-sniffer/apm-sdk-plugin/mysql-
5.x-plugin/src/main/java/org/skywalking/apm/plugin/jdbc/mysql/define/
PreparedStatementInstrumentation.java
浏览文件 @
9946a71d
...
@@ -23,12 +23,15 @@ import net.bytebuddy.matcher.ElementMatcher;
...
@@ -23,12 +23,15 @@ import net.bytebuddy.matcher.ElementMatcher;
import
org.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoint
;
import
org.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoint
;
import
org.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint
;
import
org.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint
;
import
org.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassInstanceMethodsEnhancePluginDefine
;
import
org.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassInstanceMethodsEnhancePluginDefine
;
import
org.skywalking.apm.agent.core.plugin.match.ClassMatch
;
import
static
net
.
bytebuddy
.
matcher
.
ElementMatchers
.
named
;
import
static
net
.
bytebuddy
.
matcher
.
ElementMatchers
.
named
;
import
static
org
.
skywalking
.
apm
.
plugin
.
jdbc
.
mysql
.
define
.
MultiClassNameMatch
.
byMultiClassMatch
;
/**
/**
* {@link AbstractPreparedStatementInstrumentation} define that the mysql-2.x plugin intercepts the following methods in
* {@link PreparedStatementInstrumentation} define that the mysql-2.x plugin intercepts the following methods in the
* the {@link com.mysql.jdbc.JDBC42PreparedStatement} and {@link com.mysql.jdbc.PreparedStatement} class.
* {@link com.mysql.jdbc.JDBC42PreparedStatement}, {@link com.mysql.jdbc.PreparedStatement} and {@link
* com.mysql.cj.jdbc.PreparedStatement} class:
* 1. execute <br/>
* 1. execute <br/>
* 2. executeQuery <br/>
* 2. executeQuery <br/>
* 3. executeUpdate <br/>
* 3. executeUpdate <br/>
...
@@ -37,9 +40,12 @@ import static net.bytebuddy.matcher.ElementMatchers.named;
...
@@ -37,9 +40,12 @@ import static net.bytebuddy.matcher.ElementMatchers.named;
*
*
* @author zhangxin
* @author zhangxin
*/
*/
public
abstract
class
Abstract
PreparedStatementInstrumentation
extends
ClassInstanceMethodsEnhancePluginDefine
{
public
class
PreparedStatementInstrumentation
extends
ClassInstanceMethodsEnhancePluginDefine
{
private
static
final
String
PREPARED_STATEMENT_CLASS_NAME
=
"com.mysql.jdbc.PreparedStatement"
;
private
static
final
String
SERVICE_METHOD_INTERCEPTOR
=
"org.skywalking.apm.plugin.jdbc.mysql.StatementExecuteMethodsInterceptor"
;
private
static
final
String
SERVICE_METHOD_INTERCEPTOR
=
"org.skywalking.apm.plugin.jdbc.mysql.StatementExecuteMethodsInterceptor"
;
public
static
final
String
MYSQL6_PREPARED_STATEMENT_CLASS_NAME
=
"com.mysql.cj.jdbc.PreparedStatement"
;
public
static
final
String
JDBC42_PREPARED_STATEMENT_CLASS_NAME
=
"com.mysql.jdbc.JDBC42PreparedStatement"
;
@Override
protected
final
ConstructorInterceptPoint
[]
getConstructorsInterceptPoints
()
{
@Override
protected
final
ConstructorInterceptPoint
[]
getConstructorsInterceptPoints
()
{
return
new
ConstructorInterceptPoint
[
0
];
return
new
ConstructorInterceptPoint
[
0
];
...
@@ -66,4 +72,8 @@ public abstract class AbstractPreparedStatementInstrumentation extends ClassInst
...
@@ -66,4 +72,8 @@ public abstract class AbstractPreparedStatementInstrumentation extends ClassInst
}
}
};
};
}
}
@Override
protected
ClassMatch
enhanceClass
()
{
return
byMultiClassMatch
(
PREPARED_STATEMENT_CLASS_NAME
,
MYSQL6_PREPARED_STATEMENT_CLASS_NAME
,
JDBC42_PREPARED_STATEMENT_CLASS_NAME
);
}
}
}
apm-sniffer/apm-sdk-plugin/mysql-
2
.x-plugin/src/main/java/org/skywalking/apm/plugin/jdbc/mysql/define/StatementEnhanceInfos.java
→
apm-sniffer/apm-sdk-plugin/mysql-
5
.x-plugin/src/main/java/org/skywalking/apm/plugin/jdbc/mysql/define/StatementEnhanceInfos.java
浏览文件 @
9946a71d
文件已移动
apm-sniffer/apm-sdk-plugin/mysql-
2
.x-plugin/src/main/java/org/skywalking/apm/plugin/jdbc/mysql/define/StatementInstrumentation.java
→
apm-sniffer/apm-sdk-plugin/mysql-
5
.x-plugin/src/main/java/org/skywalking/apm/plugin/jdbc/mysql/define/StatementInstrumentation.java
浏览文件 @
9946a71d
...
@@ -26,11 +26,11 @@ import org.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassInstanceMet
...
@@ -26,11 +26,11 @@ import org.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassInstanceMet
import
org.skywalking.apm.agent.core.plugin.match.ClassMatch
;
import
org.skywalking.apm.agent.core.plugin.match.ClassMatch
;
import
static
net
.
bytebuddy
.
matcher
.
ElementMatchers
.
named
;
import
static
net
.
bytebuddy
.
matcher
.
ElementMatchers
.
named
;
import
static
org
.
skywalking
.
apm
.
plugin
.
jdbc
.
mysql
.
define
.
MultiClassNameMatch
.
byMultiClassMath
;
import
static
org
.
skywalking
.
apm
.
plugin
.
jdbc
.
mysql
.
define
.
MultiClassNameMatch
.
byMultiClassMat
c
h
;
/**
/**
* {@link
JDBC42Prepared
StatementInstrumentation} intercepts the following methods in the {@link
* {@link StatementInstrumentation} intercepts the following methods in the {@link
* com.mysql.jdbc.
JDBC42PreparedStatement}
class.
* com.mysql.jdbc.
StatementImpl} and {@link com.mysql.cj.jdbc.StatementImpl}
class.
* 1. execute <br/>
* 1. execute <br/>
* 2. executeQuery <br/>
* 2. executeQuery <br/>
* 3. executeUpdate <br/>
* 3. executeUpdate <br/>
...
@@ -44,8 +44,9 @@ import static org.skywalking.apm.plugin.jdbc.mysql.define.MultiClassNameMatch.by
...
@@ -44,8 +44,9 @@ import static org.skywalking.apm.plugin.jdbc.mysql.define.MultiClassNameMatch.by
* @author zhangxin
* @author zhangxin
*/
*/
public
class
StatementInstrumentation
extends
ClassInstanceMethodsEnhancePluginDefine
{
public
class
StatementInstrumentation
extends
ClassInstanceMethodsEnhancePluginDefine
{
private
static
final
String
ENHANCE_CLASS
=
"com.mysql.jdbc.StatementImpl"
;
private
static
final
String
STATEMENT_CLASS_NAME
=
"com.mysql.jdbc.StatementImpl"
;
private
static
final
String
SERVICE_METHOD_INTERCEPTOR
=
"org.skywalking.apm.plugin.jdbc.mysql.StatementExecuteMethodsInterceptor"
;
private
static
final
String
SERVICE_METHOD_INTERCEPTOR
=
"org.skywalking.apm.plugin.jdbc.mysql.StatementExecuteMethodsInterceptor"
;
public
static
final
String
MYSQL6_STATEMENT_CLASS_NAME
=
"com.mysql.cj.jdbc.StatementImpl"
;
@Override
protected
ConstructorInterceptPoint
[]
getConstructorsInterceptPoints
()
{
@Override
protected
ConstructorInterceptPoint
[]
getConstructorsInterceptPoints
()
{
return
new
ConstructorInterceptPoint
[
0
];
return
new
ConstructorInterceptPoint
[
0
];
...
@@ -78,6 +79,6 @@ public class StatementInstrumentation extends ClassInstanceMethodsEnhancePluginD
...
@@ -78,6 +79,6 @@ public class StatementInstrumentation extends ClassInstanceMethodsEnhancePluginD
}
}
@Override
protected
ClassMatch
enhanceClass
()
{
@Override
protected
ClassMatch
enhanceClass
()
{
return
byMultiClassMat
h
(
ENHANCE_CLASS
,
"com.mysql.cj.jdbc.StatementImpl"
);
return
byMultiClassMat
ch
(
STATEMENT_CLASS_NAME
,
MYSQL6_STATEMENT_CLASS_NAME
);
}
}
}
}
apm-sniffer/apm-sdk-plugin/mysql-5.x-plugin/src/main/resources/skywalking-plugin.def
0 → 100644
浏览文件 @
9946a71d
mysql-5.x=org.skywalking.apm.plugin.jdbc.mysql.define.DriverInstrumentation
mysql-5.x=org.skywalking.apm.plugin.jdbc.mysql.define.ConnectionInstrumentation
mysql-5.x=org.skywalking.apm.plugin.jdbc.mysql.define.CallableInstrumentation
mysql-5.x=org.skywalking.apm.plugin.jdbc.mysql.define.PreparedStatementInstrumentation
mysql-5.x=org.skywalking.apm.plugin.jdbc.mysql.define.StatementInstrumentation
apm-sniffer/apm-sdk-plugin/mysql-
2
.x-plugin/src/test/java/org/skywalking/apm/plugin/jdbc/mysql/CreateCallableStatementInterceptorTest.java
→
apm-sniffer/apm-sdk-plugin/mysql-
5
.x-plugin/src/test/java/org/skywalking/apm/plugin/jdbc/mysql/CreateCallableStatementInterceptorTest.java
浏览文件 @
9946a71d
文件已移动
apm-sniffer/apm-sdk-plugin/mysql-
2
.x-plugin/src/test/java/org/skywalking/apm/plugin/jdbc/mysql/CreatePreparedStatementInterceptorTest.java
→
apm-sniffer/apm-sdk-plugin/mysql-
5
.x-plugin/src/test/java/org/skywalking/apm/plugin/jdbc/mysql/CreatePreparedStatementInterceptorTest.java
浏览文件 @
9946a71d
文件已移动
apm-sniffer/apm-sdk-plugin/mysql-
2
.x-plugin/src/test/java/org/skywalking/apm/plugin/jdbc/mysql/CreateStatementInterceptorTest.java
→
apm-sniffer/apm-sdk-plugin/mysql-
5
.x-plugin/src/test/java/org/skywalking/apm/plugin/jdbc/mysql/CreateStatementInterceptorTest.java
浏览文件 @
9946a71d
文件已移动
apm-sniffer/apm-sdk-plugin/mysql-
2
.x-plugin/src/test/java/org/skywalking/apm/plugin/jdbc/mysql/StatementExecuteMethodsInterceptorTest.java
→
apm-sniffer/apm-sdk-plugin/mysql-
5
.x-plugin/src/test/java/org/skywalking/apm/plugin/jdbc/mysql/StatementExecuteMethodsInterceptorTest.java
浏览文件 @
9946a71d
文件已移动
apm-sniffer/apm-sdk-plugin/pom.xml
浏览文件 @
9946a71d
...
@@ -48,7 +48,7 @@
...
@@ -48,7 +48,7 @@
<module>
sharding-jdbc-1.5.x-plugin
</module>
<module>
sharding-jdbc-1.5.x-plugin
</module>
<module>
xmemcached-2.x-plugin
</module>
<module>
xmemcached-2.x-plugin
</module>
<module>
grpc-1.x-plugin
</module>
<module>
grpc-1.x-plugin
</module>
<module>
mysql-
2
.x-plugin
</module>
<module>
mysql-
5
.x-plugin
</module>
<module>
h2-1.x-plugin
</module>
<module>
h2-1.x-plugin
</module>
<module>
postgresql-8.x-plugin
</module>
<module>
postgresql-8.x-plugin
</module>
<module>
oracle-10.x-plugin
</module>
<module>
oracle-10.x-plugin
</module>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录