Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
阿信在这里
SkyWalking
提交
1307b0b5
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,发现更多精彩内容 >>
未验证
提交
1307b0b5
编写于
1月 07, 2021
作者:
Z
zifeihan
提交者:
GitHub
1月 07, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix mssql-plugin occur ClassCastException when call the method of return generate key (#6133)
上级
cf9b7b1a
变更
20
隐藏空白更改
内联
并排
Showing
20 changed file
with
692 addition
and
42 deletion
+692
-42
CHANGES.md
CHANGES.md
+1
-0
apm-sniffer/apm-sdk-plugin/mssql-commons/pom.xml
apm-sniffer/apm-sdk-plugin/mssql-commons/pom.xml
+53
-0
apm-sniffer/apm-sdk-plugin/mssql-commons/src/main/java/org/apache/skywalking/apm/plugin/mssql/commons/Constants.java
...apache/skywalking/apm/plugin/mssql/commons/Constants.java
+27
-0
apm-sniffer/apm-sdk-plugin/mssql-commons/src/main/java/org/apache/skywalking/apm/plugin/mssql/commons/CreateCallableStatementInterceptor.java
...gin/mssql/commons/CreateCallableStatementInterceptor.java
+49
-0
apm-sniffer/apm-sdk-plugin/mssql-commons/src/main/java/org/apache/skywalking/apm/plugin/mssql/commons/CreatePreparedStatementInterceptor.java
...gin/mssql/commons/CreatePreparedStatementInterceptor.java
+48
-0
apm-sniffer/apm-sdk-plugin/mssql-commons/src/main/java/org/apache/skywalking/apm/plugin/mssql/commons/CreateStatementInterceptor.java
.../apm/plugin/mssql/commons/CreateStatementInterceptor.java
+49
-0
apm-sniffer/apm-sdk-plugin/mssql-commons/src/main/java/org/apache/skywalking/apm/plugin/mssql/commons/PreparedStatementExecuteMethodsInterceptor.java
...l/commons/PreparedStatementExecuteMethodsInterceptor.java
+76
-0
apm-sniffer/apm-sdk-plugin/mssql-commons/src/main/java/org/apache/skywalking/apm/plugin/mssql/commons/StatementExecuteMethodsInterceptor.java
...gin/mssql/commons/StatementExecuteMethodsInterceptor.java
+81
-0
apm-sniffer/apm-sdk-plugin/mssql-commons/src/main/java/org/apache/skywalking/apm/plugin/mssql/commons/define/AbstractConnectionInstrumentation.java
...sql/commons/define/AbstractConnectionInstrumentation.java
+11
-42
apm-sniffer/apm-sdk-plugin/mssql-jdbc-plugin/pom.xml
apm-sniffer/apm-sdk-plugin/mssql-jdbc-plugin/pom.xml
+6
-0
apm-sniffer/apm-sdk-plugin/mssql-jdbc-plugin/src/main/java/org/apache/skywalking/apm/plugin/mssql/jdbc/define/ConnectionInstrumentation.java
...m/plugin/mssql/jdbc/define/ConnectionInstrumentation.java
+1
-0
apm-sniffer/apm-sdk-plugin/mssql-jdbc-plugin/src/main/java/org/apache/skywalking/apm/plugin/mssql/jdbc/define/PreparedStatementInstrumentation.java
...n/mssql/jdbc/define/PreparedStatementInstrumentation.java
+69
-0
apm-sniffer/apm-sdk-plugin/mssql-jdbc-plugin/src/main/java/org/apache/skywalking/apm/plugin/mssql/jdbc/define/StatementInstrumentation.java
...pm/plugin/mssql/jdbc/define/StatementInstrumentation.java
+70
-0
apm-sniffer/apm-sdk-plugin/mssql-jdbc-plugin/src/main/resources/skywalking-plugin.def
...ssql-jdbc-plugin/src/main/resources/skywalking-plugin.def
+2
-0
apm-sniffer/apm-sdk-plugin/mssql-jtds-1.x-plugin/pom.xml
apm-sniffer/apm-sdk-plugin/mssql-jtds-1.x-plugin/pom.xml
+6
-0
apm-sniffer/apm-sdk-plugin/mssql-jtds-1.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/mssql/jtds/v1/define/ConnectionInstrumentation.java
...lugin/mssql/jtds/v1/define/ConnectionInstrumentation.java
+1
-0
apm-sniffer/apm-sdk-plugin/mssql-jtds-1.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/mssql/jtds/v1/define/PreparedStatementInstrumentation.java
...ssql/jtds/v1/define/PreparedStatementInstrumentation.java
+69
-0
apm-sniffer/apm-sdk-plugin/mssql-jtds-1.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/mssql/jtds/v1/define/StatementInstrumentation.java
...plugin/mssql/jtds/v1/define/StatementInstrumentation.java
+70
-0
apm-sniffer/apm-sdk-plugin/mssql-jtds-1.x-plugin/src/main/resources/skywalking-plugin.def
...-jtds-1.x-plugin/src/main/resources/skywalking-plugin.def
+2
-0
apm-sniffer/apm-sdk-plugin/pom.xml
apm-sniffer/apm-sdk-plugin/pom.xml
+1
-0
未找到文件。
CHANGES.md
浏览文件 @
1307b0b5
...
...
@@ -23,6 +23,7 @@ Release Notes.
*
Fix ArrayBlockingQueueBuffer's useless
`IF_POSSIBLE`
mode list
*
Support building gRPC TLS channel but CA file is not required.
*
Add Dolphinscheduler plugin definition.
*
Fix mssql-plugin occur ClassCastException when call the method of return generate key.
#### OAP-Backend
*
Make meter receiver support MAL.
...
...
apm-sniffer/apm-sdk-plugin/mssql-commons/pom.xml
0 → 100644
浏览文件 @
1307b0b5
<!--
~ 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.
~
-->
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<parent>
<artifactId>
apm-sdk-plugin
</artifactId>
<groupId>
org.apache.skywalking
</groupId>
<version>
8.4.0-SNAPSHOT
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
apm-mssql-commons
</artifactId>
<packaging>
jar
</packaging>
<name>
apm-mssql-commons
</name>
<url>
http://maven.apache.org
</url>
<properties>
<project.build.sourceEncoding>
UTF-8
</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>
org.apache.skywalking
</groupId>
<artifactId>
apm-jdbc-commons
</artifactId>
<version>
${project.version}
</version>
<scope>
provided
</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>
maven-deploy-plugin
</artifactId>
</plugin>
</plugins>
</build>
</project>
apm-sniffer/apm-sdk-plugin/mssql-commons/src/main/java/org/apache/skywalking/apm/plugin/mssql/commons/Constants.java
0 → 100644
浏览文件 @
1307b0b5
/*
* 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.mssql.commons
;
public
class
Constants
{
public
static
final
String
CREATE_CALLABLE_STATEMENT_INTERCEPTOR
=
"org.apache.skywalking.apm.plugin.mssql.commons.CreateCallableStatementInterceptor"
;
public
static
final
String
CREATE_PREPARED_STATEMENT_INTERCEPTOR
=
"org.apache.skywalking.apm.plugin.mssql.commons.CreatePreparedStatementInterceptor"
;
public
static
final
String
CREATE_STATEMENT_INTERCEPTOR
=
"org.apache.skywalking.apm.plugin.mssql.commons.CreateStatementInterceptor"
;
public
static
final
String
PREPARED_STATEMENT_EXECUTE_METHODS_INTERCEPTOR
=
"org.apache.skywalking.apm.plugin.mssql.commons.PreparedStatementExecuteMethodsInterceptor"
;
public
static
final
String
STATEMENT_EXECUTE_METHODS_INTERCEPTOR
=
"org.apache.skywalking.apm.plugin.mssql.commons.StatementExecuteMethodsInterceptor"
;
}
apm-sniffer/apm-sdk-plugin/mssql-commons/src/main/java/org/apache/skywalking/apm/plugin/mssql/commons/CreateCallableStatementInterceptor.java
0 → 100644
浏览文件 @
1307b0b5
/*
* 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.mssql.commons
;
import
java.lang.reflect.Method
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult
;
import
org.apache.skywalking.apm.plugin.jdbc.define.StatementEnhanceInfos
;
import
org.apache.skywalking.apm.plugin.jdbc.trace.ConnectionInfo
;
public
class
CreateCallableStatementInterceptor
implements
InstanceMethodsAroundInterceptor
{
@Override
public
void
beforeMethod
(
EnhancedInstance
objInst
,
Method
method
,
Object
[]
allArguments
,
Class
<?>[]
argumentsTypes
,
MethodInterceptResult
result
)
throws
Throwable
{
}
@Override
public
Object
afterMethod
(
EnhancedInstance
objInst
,
Method
method
,
Object
[]
allArguments
,
Class
<?>[]
argumentsTypes
,
Object
ret
)
throws
Throwable
{
if
(
ret
instanceof
EnhancedInstance
)
{
((
EnhancedInstance
)
ret
).
setSkyWalkingDynamicField
(
new
StatementEnhanceInfos
((
ConnectionInfo
)
objInst
.
getSkyWalkingDynamicField
(),
(
String
)
allArguments
[
0
],
"CallableStatement"
));
}
return
ret
;
}
@Override
public
void
handleMethodException
(
EnhancedInstance
objInst
,
Method
method
,
Object
[]
allArguments
,
Class
<?>[]
argumentsTypes
,
Throwable
t
)
{
}
}
apm-sniffer/apm-sdk-plugin/mssql-commons/src/main/java/org/apache/skywalking/apm/plugin/mssql/commons/CreatePreparedStatementInterceptor.java
0 → 100644
浏览文件 @
1307b0b5
/*
* 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.mssql.commons
;
import
java.lang.reflect.Method
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult
;
import
org.apache.skywalking.apm.plugin.jdbc.define.StatementEnhanceInfos
;
import
org.apache.skywalking.apm.plugin.jdbc.trace.ConnectionInfo
;
public
class
CreatePreparedStatementInterceptor
implements
InstanceMethodsAroundInterceptor
{
@Override
public
void
beforeMethod
(
EnhancedInstance
objInst
,
Method
method
,
Object
[]
allArguments
,
Class
<?>[]
argumentsTypes
,
MethodInterceptResult
result
)
throws
Throwable
{
}
@Override
public
Object
afterMethod
(
EnhancedInstance
objInst
,
Method
method
,
Object
[]
allArguments
,
Class
<?>[]
argumentsTypes
,
Object
ret
)
throws
Throwable
{
if
(
ret
instanceof
EnhancedInstance
)
{
((
EnhancedInstance
)
ret
).
setSkyWalkingDynamicField
(
new
StatementEnhanceInfos
((
ConnectionInfo
)
objInst
.
getSkyWalkingDynamicField
(),
(
String
)
allArguments
[
0
],
"PreparedStatement"
));
}
return
ret
;
}
@Override
public
void
handleMethodException
(
EnhancedInstance
objInst
,
Method
method
,
Object
[]
allArguments
,
Class
<?>[]
argumentsTypes
,
Throwable
t
)
{
}
}
apm-sniffer/apm-sdk-plugin/mssql-commons/src/main/java/org/apache/skywalking/apm/plugin/mssql/commons/CreateStatementInterceptor.java
0 → 100644
浏览文件 @
1307b0b5
/*
* 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.mssql.commons
;
import
java.lang.reflect.Method
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult
;
import
org.apache.skywalking.apm.plugin.jdbc.define.StatementEnhanceInfos
;
import
org.apache.skywalking.apm.plugin.jdbc.trace.ConnectionInfo
;
public
class
CreateStatementInterceptor
implements
InstanceMethodsAroundInterceptor
{
@Override
public
void
beforeMethod
(
EnhancedInstance
objInst
,
Method
method
,
Object
[]
allArguments
,
Class
<?>[]
argumentsTypes
,
MethodInterceptResult
result
)
throws
Throwable
{
}
@Override
public
Object
afterMethod
(
EnhancedInstance
objInst
,
Method
method
,
Object
[]
allArguments
,
Class
<?>[]
argumentsTypes
,
Object
ret
)
throws
Throwable
{
if
(
ret
instanceof
EnhancedInstance
)
{
((
EnhancedInstance
)
ret
).
setSkyWalkingDynamicField
(
new
StatementEnhanceInfos
((
ConnectionInfo
)
objInst
.
getSkyWalkingDynamicField
(),
""
,
"Statement"
));
}
return
ret
;
}
@Override
public
void
handleMethodException
(
EnhancedInstance
objInst
,
Method
method
,
Object
[]
allArguments
,
Class
<?>[]
argumentsTypes
,
Throwable
t
)
{
}
}
apm-sniffer/apm-sdk-plugin/mssql-commons/src/main/java/org/apache/skywalking/apm/plugin/mssql/commons/PreparedStatementExecuteMethodsInterceptor.java
0 → 100644
浏览文件 @
1307b0b5
/*
* 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.mssql.commons
;
import
java.lang.reflect.Method
;
import
org.apache.skywalking.apm.agent.core.context.ContextManager
;
import
org.apache.skywalking.apm.agent.core.context.tag.Tags
;
import
org.apache.skywalking.apm.agent.core.context.trace.AbstractSpan
;
import
org.apache.skywalking.apm.agent.core.context.trace.SpanLayer
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult
;
import
org.apache.skywalking.apm.plugin.jdbc.SqlBodyUtil
;
import
org.apache.skywalking.apm.plugin.jdbc.define.StatementEnhanceInfos
;
import
org.apache.skywalking.apm.plugin.jdbc.trace.ConnectionInfo
;
public
class
PreparedStatementExecuteMethodsInterceptor
implements
InstanceMethodsAroundInterceptor
{
@Override
public
final
void
beforeMethod
(
EnhancedInstance
objInst
,
Method
method
,
Object
[]
allArguments
,
Class
<?>[]
argumentsTypes
,
MethodInterceptResult
result
)
{
StatementEnhanceInfos
cacheObject
=
(
StatementEnhanceInfos
)
objInst
.
getSkyWalkingDynamicField
();
if
(
cacheObject
!=
null
&&
cacheObject
.
getConnectionInfo
()
!=
null
)
{
ConnectionInfo
connectInfo
=
cacheObject
.
getConnectionInfo
();
AbstractSpan
span
=
ContextManager
.
createExitSpan
(
buildOperationName
(
connectInfo
,
method
.
getName
(),
cacheObject
.
getStatementName
()),
connectInfo
.
getDatabasePeer
());
Tags
.
DB_TYPE
.
set
(
span
,
"sql"
);
Tags
.
DB_INSTANCE
.
set
(
span
,
connectInfo
.
getDatabaseName
());
Tags
.
DB_STATEMENT
.
set
(
span
,
SqlBodyUtil
.
limitSqlBodySize
(
cacheObject
.
getSql
()));
span
.
setComponent
(
connectInfo
.
getComponent
());
SpanLayer
.
asDB
(
span
);
}
}
@Override
public
final
Object
afterMethod
(
EnhancedInstance
objInst
,
Method
method
,
Object
[]
allArguments
,
Class
<?>[]
argumentsTypes
,
Object
ret
)
{
StatementEnhanceInfos
cacheObject
=
(
StatementEnhanceInfos
)
objInst
.
getSkyWalkingDynamicField
();
if
(
cacheObject
!=
null
&&
cacheObject
.
getConnectionInfo
()
!=
null
)
{
ContextManager
.
stopSpan
();
}
return
ret
;
}
@Override
public
final
void
handleMethodException
(
EnhancedInstance
objInst
,
Method
method
,
Object
[]
allArguments
,
Class
<?>[]
argumentsTypes
,
Throwable
t
)
{
StatementEnhanceInfos
cacheObject
=
(
StatementEnhanceInfos
)
objInst
.
getSkyWalkingDynamicField
();
if
(
cacheObject
!=
null
&&
cacheObject
.
getConnectionInfo
()
!=
null
)
{
ContextManager
.
activeSpan
().
log
(
t
);
}
}
private
String
buildOperationName
(
ConnectionInfo
connectionInfo
,
String
methodName
,
String
statementName
)
{
return
connectionInfo
.
getDBType
()
+
"/JDBI/"
+
statementName
+
"/"
+
methodName
;
}
}
apm-sniffer/apm-sdk-plugin/mssql-commons/src/main/java/org/apache/skywalking/apm/plugin/mssql/commons/StatementExecuteMethodsInterceptor.java
0 → 100644
浏览文件 @
1307b0b5
/*
* 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.mssql.commons
;
import
java.lang.reflect.Method
;
import
org.apache.skywalking.apm.agent.core.context.ContextManager
;
import
org.apache.skywalking.apm.agent.core.context.tag.Tags
;
import
org.apache.skywalking.apm.agent.core.context.trace.AbstractSpan
;
import
org.apache.skywalking.apm.agent.core.context.trace.SpanLayer
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult
;
import
org.apache.skywalking.apm.plugin.jdbc.SqlBodyUtil
;
import
org.apache.skywalking.apm.plugin.jdbc.define.StatementEnhanceInfos
;
import
org.apache.skywalking.apm.plugin.jdbc.trace.ConnectionInfo
;
public
class
StatementExecuteMethodsInterceptor
implements
InstanceMethodsAroundInterceptor
{
@Override
public
final
void
beforeMethod
(
EnhancedInstance
objInst
,
Method
method
,
Object
[]
allArguments
,
Class
<?>[]
argumentsTypes
,
MethodInterceptResult
result
)
throws
Throwable
{
StatementEnhanceInfos
cacheObject
=
(
StatementEnhanceInfos
)
objInst
.
getSkyWalkingDynamicField
();
ConnectionInfo
connectInfo
=
cacheObject
.
getConnectionInfo
();
if
(
connectInfo
!=
null
)
{
AbstractSpan
span
=
ContextManager
.
createExitSpan
(
buildOperationName
(
connectInfo
,
method
.
getName
(),
cacheObject
.
getStatementName
()),
connectInfo
.
getDatabasePeer
());
Tags
.
DB_TYPE
.
set
(
span
,
"sql"
);
Tags
.
DB_INSTANCE
.
set
(
span
,
connectInfo
.
getDatabaseName
());
String
sql
=
""
;
if
(
allArguments
.
length
>
0
)
{
sql
=
(
String
)
allArguments
[
0
];
sql
=
SqlBodyUtil
.
limitSqlBodySize
(
sql
);
}
Tags
.
DB_STATEMENT
.
set
(
span
,
sql
);
span
.
setComponent
(
connectInfo
.
getComponent
());
SpanLayer
.
asDB
(
span
);
}
}
@Override
public
final
Object
afterMethod
(
EnhancedInstance
objInst
,
Method
method
,
Object
[]
allArguments
,
Class
<?>[]
argumentsTypes
,
Object
ret
)
throws
Throwable
{
StatementEnhanceInfos
cacheObject
=
(
StatementEnhanceInfos
)
objInst
.
getSkyWalkingDynamicField
();
if
(
cacheObject
.
getConnectionInfo
()
!=
null
)
{
ContextManager
.
stopSpan
();
}
return
ret
;
}
@Override
public
final
void
handleMethodException
(
EnhancedInstance
objInst
,
Method
method
,
Object
[]
allArguments
,
Class
<?>[]
argumentsTypes
,
Throwable
t
)
{
StatementEnhanceInfos
cacheObject
=
(
StatementEnhanceInfos
)
objInst
.
getSkyWalkingDynamicField
();
if
(
cacheObject
.
getConnectionInfo
()
!=
null
)
{
ContextManager
.
activeSpan
().
log
(
t
);
}
}
private
String
buildOperationName
(
ConnectionInfo
connectionInfo
,
String
methodName
,
String
statementName
)
{
return
connectionInfo
.
getDBType
()
+
"/JDBI/"
+
statementName
+
"/"
+
methodName
;
}
}
apm-sniffer/apm-sdk-plugin/mssql-
jdbc-plugin/src/main/java/org/apache/skywalking/apm/plugin/mssql/jdbc
/define/AbstractConnectionInstrumentation.java
→
apm-sniffer/apm-sdk-plugin/mssql-
commons/src/main/java/org/apache/skywalking/apm/plugin/mssql/commons
/define/AbstractConnectionInstrumentation.java
浏览文件 @
1307b0b5
...
...
@@ -16,7 +16,7 @@
*
*/
package
org.apache.skywalking.apm.plugin.mssql.
jdbc
.define
;
package
org.apache.skywalking.apm.plugin.mssql.
commons
.define
;
import
net.bytebuddy.description.method.MethodDescription
;
import
net.bytebuddy.matcher.ElementMatcher
;
...
...
@@ -32,10 +32,10 @@ import static net.bytebuddy.matcher.ElementMatchers.takesArguments;
* {@link AbstractConnectionInstrumentation} define how to enhance the following methods that the class which extend
* {@link java.sql.Connection}.
* <p>
* 1. Enhance <code>prepareStatement</code> by <code>org.apache.skywalking.apm.plugin.
jdbc.define.JDBCPrepare
StatementInterceptor</code>
* 2. Enhance <code>prepareCall</code> by <code>org.apache.skywalking.apm.plugin.
jdbc.define.JDBCPrepareCall
Interceptor</code>
* 3. Enhance <code>createStatement</code> by <code>org.apache.skywalking.apm.plugin.
jdbc.define.JDBC
StatementInterceptor</code>
* 4. Enhance <code>commit, rollback, close, releaseSavepoint</code> by <code>org.apache.skywalking.apm.plugin.jdbc.
define.
ConnectionServiceMethodInterceptor</code>
* 1. Enhance <code>prepareStatement</code> by <code>org.apache.skywalking.apm.plugin.
mssql.commons.CreatePrepared
StatementInterceptor</code>
* 2. Enhance <code>prepareCall</code> by <code>org.apache.skywalking.apm.plugin.
mssql.commons.CreateCallableStatement
Interceptor</code>
* 3. Enhance <code>createStatement</code> by <code>org.apache.skywalking.apm.plugin.
mssql.commons.Create
StatementInterceptor</code>
* 4. Enhance <code>commit, rollback, close, releaseSavepoint</code> by <code>org.apache.skywalking.apm.plugin.jdbc.ConnectionServiceMethodInterceptor</code>
*/
public
abstract
class
AbstractConnectionInstrumentation
extends
ClassInstanceMethodsEnhancePluginDefine
{
...
...
@@ -50,44 +50,12 @@ public abstract class AbstractConnectionInstrumentation extends ClassInstanceMet
new
InstanceMethodsInterceptPoint
()
{
@Override
public
ElementMatcher
<
MethodDescription
>
getMethodsMatcher
()
{
return
named
(
Constants
.
PREPARE_STATEMENT_METHOD_NAME
)
.
and
(
takesArguments
(
1
))
;
return
named
(
Constants
.
PREPARE_STATEMENT_METHOD_NAME
);
}
@Override
public
String
getMethodsInterceptor
()
{
return
Constants
.
PREPARE_STATEMENT_INTERCEPT_CLASS
;
}
@Override
public
boolean
isOverrideArgs
()
{
return
false
;
}
},
new
InstanceMethodsInterceptPoint
()
{
@Override
public
ElementMatcher
<
MethodDescription
>
getMethodsMatcher
()
{
return
named
(
Constants
.
PREPARE_STATEMENT_METHOD_NAME
).
and
(
takesArguments
(
3
));
}
@Override
public
String
getMethodsInterceptor
()
{
return
Constants
.
PREPARE_STATEMENT_INTERCEPT_CLASS
;
}
@Override
public
boolean
isOverrideArgs
()
{
return
false
;
}
},
new
InstanceMethodsInterceptPoint
()
{
@Override
public
ElementMatcher
<
MethodDescription
>
getMethodsMatcher
()
{
return
named
(
Constants
.
PREPARE_STATEMENT_METHOD_NAME
).
and
(
takesArguments
(
4
));
}
@Override
public
String
getMethodsInterceptor
()
{
return
Constants
.
PREPARE_STATEMENT_INTERCEPT_CLASS
;
return
org
.
apache
.
skywalking
.
apm
.
plugin
.
mssql
.
commons
.
Constants
.
CREATE_PREPARED_STATEMENT_INTERCEPTOR
;
}
@Override
...
...
@@ -103,7 +71,7 @@ public abstract class AbstractConnectionInstrumentation extends ClassInstanceMet
@Override
public
String
getMethodsInterceptor
()
{
return
Constants
.
PREPARE_CALL_INTERCEPT_CLASS
;
return
org
.
apache
.
skywalking
.
apm
.
plugin
.
mssql
.
commons
.
Constants
.
CREATE_CALLABLE_STATEMENT_INTERCEPTOR
;
}
@Override
...
...
@@ -114,12 +82,12 @@ public abstract class AbstractConnectionInstrumentation extends ClassInstanceMet
new
InstanceMethodsInterceptPoint
()
{
@Override
public
ElementMatcher
<
MethodDescription
>
getMethodsMatcher
()
{
return
named
(
Constants
.
CREATE_STATEMENT_METHOD_NAME
);
return
named
(
Constants
.
CREATE_STATEMENT_METHOD_NAME
)
.
and
(
takesArguments
(
2
))
;
}
@Override
public
String
getMethodsInterceptor
()
{
return
Constants
.
CREATE_STATEMENT_INTERCEPT_CLASS
;
return
org
.
apache
.
skywalking
.
apm
.
plugin
.
mssql
.
commons
.
Constants
.
CREATE_STATEMENT_INTERCEPTOR
;
}
@Override
...
...
@@ -146,5 +114,6 @@ public abstract class AbstractConnectionInstrumentation extends ClassInstanceMet
}
}
};
}
}
apm-sniffer/apm-sdk-plugin/mssql-jdbc-plugin/pom.xml
浏览文件 @
1307b0b5
...
...
@@ -41,6 +41,12 @@
<version>
${project.version}
</version>
<scope>
provided
</scope>
</dependency>
<dependency>
<groupId>
org.apache.skywalking
</groupId>
<artifactId>
apm-mssql-commons
</artifactId>
<version>
${project.version}
</version>
<scope>
provided
</scope>
</dependency>
<dependency>
<groupId>
com.microsoft.sqlserver
</groupId>
...
...
apm-sniffer/apm-sdk-plugin/mssql-jdbc-plugin/src/main/java/org/apache/skywalking/apm/plugin/mssql/jdbc/define/ConnectionInstrumentation.java
浏览文件 @
1307b0b5
...
...
@@ -19,6 +19,7 @@
package
org.apache.skywalking.apm.plugin.mssql.jdbc.define
;
import
org.apache.skywalking.apm.agent.core.plugin.match.ClassMatch
;
import
org.apache.skywalking.apm.plugin.mssql.commons.define.AbstractConnectionInstrumentation
;
import
static
org
.
apache
.
skywalking
.
apm
.
agent
.
core
.
plugin
.
match
.
NameMatch
.
byName
;
...
...
apm-sniffer/apm-sdk-plugin/mssql-jdbc-plugin/src/main/java/org/apache/skywalking/apm/plugin/mssql/jdbc/define/PreparedStatementInstrumentation.java
0 → 100644
浏览文件 @
1307b0b5
/*
* 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.mssql.jdbc.define
;
import
net.bytebuddy.description.method.MethodDescription
;
import
net.bytebuddy.matcher.ElementMatcher
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoint
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassInstanceMethodsEnhancePluginDefine
;
import
org.apache.skywalking.apm.agent.core.plugin.match.ClassMatch
;
import
org.apache.skywalking.apm.plugin.mssql.commons.Constants
;
import
static
net
.
bytebuddy
.
matcher
.
ElementMatchers
.
named
;
import
static
org
.
apache
.
skywalking
.
apm
.
agent
.
core
.
plugin
.
match
.
NameMatch
.
byName
;
public
class
PreparedStatementInstrumentation
extends
ClassInstanceMethodsEnhancePluginDefine
{
public
static
final
String
PREPARED_STATEMENT_CLASS_NAME
=
"com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement"
;
@Override
public
final
ConstructorInterceptPoint
[]
getConstructorsInterceptPoints
()
{
return
new
ConstructorInterceptPoint
[
0
];
}
@Override
public
InstanceMethodsInterceptPoint
[]
getInstanceMethodsInterceptPoints
()
{
return
new
InstanceMethodsInterceptPoint
[]
{
new
InstanceMethodsInterceptPoint
()
{
@Override
public
ElementMatcher
<
MethodDescription
>
getMethodsMatcher
()
{
return
named
(
"execute"
).
or
(
named
(
"executeQuery"
))
.
or
(
named
(
"executeUpdate"
));
}
@Override
public
String
getMethodsInterceptor
()
{
return
Constants
.
PREPARED_STATEMENT_EXECUTE_METHODS_INTERCEPTOR
;
}
@Override
public
boolean
isOverrideArgs
()
{
return
false
;
}
}
};
}
@Override
protected
ClassMatch
enhanceClass
()
{
return
byName
(
PREPARED_STATEMENT_CLASS_NAME
);
}
}
apm-sniffer/apm-sdk-plugin/mssql-jdbc-plugin/src/main/java/org/apache/skywalking/apm/plugin/mssql/jdbc/define/StatementInstrumentation.java
0 → 100644
浏览文件 @
1307b0b5
/*
* 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.mssql.jdbc.define
;
import
net.bytebuddy.description.method.MethodDescription
;
import
net.bytebuddy.matcher.ElementMatcher
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoint
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassInstanceMethodsEnhancePluginDefine
;
import
org.apache.skywalking.apm.agent.core.plugin.match.ClassMatch
;
import
org.apache.skywalking.apm.plugin.mssql.commons.Constants
;
import
static
net
.
bytebuddy
.
matcher
.
ElementMatchers
.
named
;
import
static
org
.
apache
.
skywalking
.
apm
.
agent
.
core
.
plugin
.
match
.
NameMatch
.
byName
;
public
class
StatementInstrumentation
extends
ClassInstanceMethodsEnhancePluginDefine
{
public
static
final
String
STATEMENT_CLASS_NAME
=
"com.microsoft.sqlserver.jdbc.SQLServerStatement"
;
@Override
public
ConstructorInterceptPoint
[]
getConstructorsInterceptPoints
()
{
return
new
ConstructorInterceptPoint
[
0
];
}
@Override
public
InstanceMethodsInterceptPoint
[]
getInstanceMethodsInterceptPoints
()
{
return
new
InstanceMethodsInterceptPoint
[]
{
new
InstanceMethodsInterceptPoint
()
{
@Override
public
ElementMatcher
<
MethodDescription
>
getMethodsMatcher
()
{
return
named
(
"execute"
).
or
(
named
(
"executeQuery"
))
.
or
(
named
(
"executeUpdate"
))
.
or
(
named
(
"executeQuery"
))
.
or
(
named
(
"executeBatch"
));
}
@Override
public
String
getMethodsInterceptor
()
{
return
Constants
.
STATEMENT_EXECUTE_METHODS_INTERCEPTOR
;
}
@Override
public
boolean
isOverrideArgs
()
{
return
false
;
}
}
};
}
@Override
protected
ClassMatch
enhanceClass
()
{
return
byName
(
STATEMENT_CLASS_NAME
);
}
}
apm-sniffer/apm-sdk-plugin/mssql-jdbc-plugin/src/main/resources/skywalking-plugin.def
浏览文件 @
1307b0b5
...
...
@@ -16,3 +16,5 @@
mssql-jdbc=org.apache.skywalking.apm.plugin.mssql.jdbc.define.DriverInstrumentation
mssql-jdbc=org.apache.skywalking.apm.plugin.mssql.jdbc.define.ConnectionInstrumentation
mssql-jdbc=org.apache.skywalking.apm.plugin.mssql.jdbc.define.PreparedStatementInstrumentation
mssql-jdbc=org.apache.skywalking.apm.plugin.mssql.jdbc.define.StatementInstrumentation
\ No newline at end of file
apm-sniffer/apm-sdk-plugin/mssql-jtds-1.x-plugin/pom.xml
浏览文件 @
1307b0b5
...
...
@@ -41,6 +41,12 @@
<version>
${project.version}
</version>
<scope>
provided
</scope>
</dependency>
<dependency>
<groupId>
org.apache.skywalking
</groupId>
<artifactId>
apm-mssql-commons
</artifactId>
<version>
${project.version}
</version>
<scope>
provided
</scope>
</dependency>
<dependency>
<groupId>
net.sourceforge.jtds
</groupId>
...
...
apm-sniffer/apm-sdk-plugin/mssql-jtds-1.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/mssql/jtds/v1/define/ConnectionInstrumentation.java
浏览文件 @
1307b0b5
...
...
@@ -20,6 +20,7 @@ package org.apache.skywalking.apm.plugin.mssql.jtds.v1.define;
import
org.apache.skywalking.apm.agent.core.plugin.match.ClassMatch
;
import
org.apache.skywalking.apm.agent.core.plugin.match.MultiClassNameMatch
;
import
org.apache.skywalking.apm.plugin.mssql.commons.define.AbstractConnectionInstrumentation
;
/**
* {@link ConnectionInstrumentation} presents that skywalking intercepts.
...
...
apm-sniffer/apm-sdk-plugin/mssql-jtds-1.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/mssql/jtds/v1/define/PreparedStatementInstrumentation.java
0 → 100644
浏览文件 @
1307b0b5
/*
* 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.mssql.jtds.v1.define
;
import
net.bytebuddy.description.method.MethodDescription
;
import
net.bytebuddy.matcher.ElementMatcher
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoint
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassInstanceMethodsEnhancePluginDefine
;
import
org.apache.skywalking.apm.agent.core.plugin.match.ClassMatch
;
import
org.apache.skywalking.apm.plugin.mssql.commons.Constants
;
import
static
net
.
bytebuddy
.
matcher
.
ElementMatchers
.
named
;
import
static
org
.
apache
.
skywalking
.
apm
.
agent
.
core
.
plugin
.
match
.
NameMatch
.
byName
;
public
class
PreparedStatementInstrumentation
extends
ClassInstanceMethodsEnhancePluginDefine
{
public
static
final
String
PREPARED_STATEMENT_CLASS_NAME
=
"net.sourceforge.jtds.jdbc.JtdsPreparedStatement"
;
@Override
public
final
ConstructorInterceptPoint
[]
getConstructorsInterceptPoints
()
{
return
new
ConstructorInterceptPoint
[
0
];
}
@Override
public
InstanceMethodsInterceptPoint
[]
getInstanceMethodsInterceptPoints
()
{
return
new
InstanceMethodsInterceptPoint
[]
{
new
InstanceMethodsInterceptPoint
()
{
@Override
public
ElementMatcher
<
MethodDescription
>
getMethodsMatcher
()
{
return
named
(
"execute"
).
or
(
named
(
"executeQuery"
))
.
or
(
named
(
"executeUpdate"
));
}
@Override
public
String
getMethodsInterceptor
()
{
return
Constants
.
PREPARED_STATEMENT_EXECUTE_METHODS_INTERCEPTOR
;
}
@Override
public
boolean
isOverrideArgs
()
{
return
false
;
}
}
};
}
@Override
protected
ClassMatch
enhanceClass
()
{
return
byName
(
PREPARED_STATEMENT_CLASS_NAME
);
}
}
apm-sniffer/apm-sdk-plugin/mssql-jtds-1.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/mssql/jtds/v1/define/
AbstractConnection
Instrumentation.java
→
apm-sniffer/apm-sdk-plugin/mssql-jtds-1.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/mssql/jtds/v1/define/
Statement
Instrumentation.java
浏览文件 @
1307b0b5
...
...
@@ -23,21 +23,14 @@ import net.bytebuddy.matcher.ElementMatcher;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoint
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassInstanceMethodsEnhancePluginDefine
;
import
org.apache.skywalking.apm.plugin.jdbc.define.Constants
;
import
org.apache.skywalking.apm.agent.core.plugin.match.ClassMatch
;
import
org.apache.skywalking.apm.plugin.mssql.commons.Constants
;
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
;
/**
* {@link AbstractConnectionInstrumentation} define how to enhance the following methods that the class which extend
* {@link java.sql.Connection}.
* <p>
* 1. Enhance <code>prepareStatement</code> by <code>org.apache.skywalking.apm.plugin.jdbc.define.JDBCPrepareStatementInterceptor</code>
* 2. Enhance <code>prepareCall</code> by <code>org.apache.skywalking.apm.plugin.jdbc.define.JDBCPrepareCallInterceptor</code>
* 3. Enhance <code>createStatement</code> by <code>org.apache.skywalking.apm.plugin.jdbc.define.JDBCStatementInterceptor</code>
* 4. Enhance <code>commit, rollback, close, releaseSavepoint</code> by <code>org.apache.skywalking.apm.plugin.jdbc.define.ConnectionServiceMethodInterceptor</code>
*/
public
abstract
class
AbstractConnectionInstrumentation
extends
ClassInstanceMethodsEnhancePluginDefine
{
public
class
StatementInstrumentation
extends
ClassInstanceMethodsEnhancePluginDefine
{
public
static
final
String
STATEMENT_CLASS_NAME
=
"net.sourceforge.jtds.jdbc.JtdsStatement"
;
@Override
public
ConstructorInterceptPoint
[]
getConstructorsInterceptPoints
()
{
...
...
@@ -50,94 +43,15 @@ public abstract class AbstractConnectionInstrumentation extends ClassInstanceMet
new
InstanceMethodsInterceptPoint
()
{
@Override
public
ElementMatcher
<
MethodDescription
>
getMethodsMatcher
()
{
return
named
(
Constants
.
PREPARE_STATEMENT_METHOD_NAME
).
and
(
takesArguments
(
1
));
}
@Override
public
String
getMethodsInterceptor
()
{
return
Constants
.
PREPARE_STATEMENT_INTERCEPT_CLASS
;
}
@Override
public
boolean
isOverrideArgs
()
{
return
false
;
}
},
new
InstanceMethodsInterceptPoint
()
{
@Override
public
ElementMatcher
<
MethodDescription
>
getMethodsMatcher
()
{
return
named
(
Constants
.
PREPARE_STATEMENT_METHOD_NAME
).
and
(
takesArguments
(
3
));
}
@Override
public
String
getMethodsInterceptor
()
{
return
Constants
.
PREPARE_STATEMENT_INTERCEPT_CLASS
;
}
@Override
public
boolean
isOverrideArgs
()
{
return
false
;
}
},
new
InstanceMethodsInterceptPoint
()
{
@Override
public
ElementMatcher
<
MethodDescription
>
getMethodsMatcher
()
{
return
named
(
Constants
.
PREPARE_STATEMENT_METHOD_NAME
).
and
(
takesArguments
(
4
));
}
@Override
public
String
getMethodsInterceptor
()
{
return
Constants
.
PREPARE_STATEMENT_INTERCEPT_CLASS
;
}
@Override
public
boolean
isOverrideArgs
()
{
return
false
;
}
},
new
InstanceMethodsInterceptPoint
()
{
@Override
public
ElementMatcher
<
MethodDescription
>
getMethodsMatcher
()
{
return
named
(
Constants
.
PREPARE_CALL_METHOD_NAME
);
}
@Override
public
String
getMethodsInterceptor
()
{
return
Constants
.
PREPARE_CALL_INTERCEPT_CLASS
;
}
@Override
public
boolean
isOverrideArgs
()
{
return
false
;
}
},
new
InstanceMethodsInterceptPoint
()
{
@Override
public
ElementMatcher
<
MethodDescription
>
getMethodsMatcher
()
{
return
named
(
Constants
.
CREATE_STATEMENT_METHOD_NAME
);
return
named
(
"execute"
).
or
(
named
(
"executeQuery"
))
.
or
(
named
(
"executeUpdate"
))
.
or
(
named
(
"executeQuery"
))
.
or
(
named
(
"executeBatch"
));
}
@Override
public
String
getMethodsInterceptor
()
{
return
Constants
.
CREATE_STATEMENT_INTERCEPT_CLASS
;
}
@Override
public
boolean
isOverrideArgs
()
{
return
false
;
}
},
new
InstanceMethodsInterceptPoint
()
{
@Override
public
ElementMatcher
<
MethodDescription
>
getMethodsMatcher
()
{
return
named
(
Constants
.
COMMIT_METHOD_NAME
).
or
(
named
(
Constants
.
ROLLBACK_METHOD_NAME
))
.
or
(
named
(
Constants
.
CLOSE_METHOD_NAME
))
.
or
(
named
(
Constants
.
RELEASE_SAVE_POINT_METHOD_NAME
));
}
@Override
public
String
getMethodsInterceptor
()
{
return
Constants
.
SERVICE_METHOD_INTERCEPT_CLASS
;
return
Constants
.
STATEMENT_EXECUTE_METHODS_INTERCEPTOR
;
}
@Override
...
...
@@ -147,4 +61,10 @@ public abstract class AbstractConnectionInstrumentation extends ClassInstanceMet
}
};
}
@Override
protected
ClassMatch
enhanceClass
()
{
return
byName
(
STATEMENT_CLASS_NAME
);
}
}
apm-sniffer/apm-sdk-plugin/mssql-jtds-1.x-plugin/src/main/resources/skywalking-plugin.def
浏览文件 @
1307b0b5
...
...
@@ -16,3 +16,5 @@
mssql-jtds-1.x=org.apache.skywalking.apm.plugin.mssql.jtds.v1.define.DriverInstrumentation
mssql-jtds-1.x=org.apache.skywalking.apm.plugin.mssql.jtds.v1.define.ConnectionInstrumentation
mssql-jtds-1.x=org.apache.skywalking.apm.plugin.mssql.jtds.v1.define.PreparedStatementInstrumentation
mssql-jtds-1.x=org.apache.skywalking.apm.plugin.mssql.jtds.v1.define.StatementInstrumentation
\ No newline at end of file
apm-sniffer/apm-sdk-plugin/pom.xml
浏览文件 @
1307b0b5
...
...
@@ -104,6 +104,7 @@
<module>
httpclient-commons
</module>
<module>
asynchttpclient-2.x-plugin
</module>
<module>
dbcp-2.x-plugin
</module>
<module>
mssql-commons
</module>
<module>
mssql-jtds-1.x-plugin
</module>
<module>
mssql-jdbc-plugin
</module>
<module>
cxf-3.x-plugin
</module>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录