Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
山不在高_有仙则灵
SkyWalking
提交
7554cfab
S
SkyWalking
项目概览
山不在高_有仙则灵
/
SkyWalking
与 Fork 源项目一致
Fork自
apache / SkyWalking
通知
12
Star
0
Fork
2
代码
文件
提交
分支
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,体验更适合开发者的 AI 搜索 >>
提交
7554cfab
编写于
1月 30, 2018
作者:
A
ascrutae
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[Agent] Change the enhance way of oracle plugin
上级
c296ecf2
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
513 addition
and
73 deletion
+513
-73
apm-sniffer/apm-sdk-plugin/oracle-10.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jdbc/oracle/Constants.java
...g/apache/skywalking/apm/plugin/jdbc/oracle/Constants.java
+30
-0
apm-sniffer/apm-sdk-plugin/oracle-10.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jdbc/oracle/CreateCallableInterceptor.java
...ing/apm/plugin/jdbc/oracle/CreateCallableInterceptor.java
+6
-25
apm-sniffer/apm-sdk-plugin/oracle-10.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jdbc/oracle/CreatePreparedStatementInterceptor.java
...lugin/jdbc/oracle/CreatePreparedStatementInterceptor.java
+47
-0
apm-sniffer/apm-sdk-plugin/oracle-10.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jdbc/oracle/CreateStatementInterceptor.java
...ng/apm/plugin/jdbc/oracle/CreateStatementInterceptor.java
+47
-0
apm-sniffer/apm-sdk-plugin/oracle-10.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jdbc/oracle/PreparedStatementExecuteMethodsInterceptor.java
...bc/oracle/PreparedStatementExecuteMethodsInterceptor.java
+74
-0
apm-sniffer/apm-sdk-plugin/oracle-10.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jdbc/oracle/StatementExecuteMethodsInterceptor.java
...lugin/jdbc/oracle/StatementExecuteMethodsInterceptor.java
+76
-0
apm-sniffer/apm-sdk-plugin/oracle-10.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jdbc/oracle/define/ConnectionInstrumentation.java
.../plugin/jdbc/oracle/define/ConnectionInstrumentation.java
+15
-48
apm-sniffer/apm-sdk-plugin/oracle-10.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jdbc/oracle/define/OracleCallableInstrumentation.java
...gin/jdbc/oracle/define/OracleCallableInstrumentation.java
+70
-0
apm-sniffer/apm-sdk-plugin/oracle-10.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jdbc/oracle/define/OraclePrepareStatementInstrumentation.java
.../oracle/define/OraclePrepareStatementInstrumentation.java
+71
-0
apm-sniffer/apm-sdk-plugin/oracle-10.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jdbc/oracle/define/OracleStatementInstrumentation.java
...in/jdbc/oracle/define/OracleStatementInstrumentation.java
+74
-0
apm-sniffer/apm-sdk-plugin/oracle-10.x-plugin/src/main/resources/skywalking-plugin.def
...acle-10.x-plugin/src/main/resources/skywalking-plugin.def
+3
-0
未找到文件。
apm-sniffer/apm-sdk-plugin/oracle-10.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jdbc/oracle/Constants.java
0 → 100644
浏览文件 @
7554cfab
/*
* 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.oracle
;
/**
* Constants variables
*
* @author zhang xin
*/
public
final
class
Constants
{
public
static
final
String
STATEMENT_INTERCEPT_CLASS
=
"org.apache.skywalking.apm.plugin.jdbc.oracle.StatementExecuteMethodsInterceptor"
;
public
static
final
String
PREPARED_STATEMENT_INTERCEPT_CLASS
=
"org.apache.skywalking.apm.plugin.jdbc.oracle.PreparedStatementExecuteMethodsInterceptor"
;
}
apm-sniffer/apm-sdk-plugin/oracle-10.x-plugin/src/main/java/or
acle/jdbc/driver/JDBCPrepareStatementWithArray
Interceptor.java
→
apm-sniffer/apm-sdk-plugin/oracle-10.x-plugin/src/main/java/or
g/apache/skywalking/apm/plugin/jdbc/oracle/CreateCallable
Interceptor.java
浏览文件 @
7554cfab
...
...
@@ -16,26 +16,16 @@
*
*/
package
or
acle.jdbc.driver
;
package
or
g.apache.skywalking.apm.plugin.jdbc.oracle
;
import
java.lang.reflect.Method
;
import
java.sql.Connection
;
import
java.sql.PreparedStatement
;
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
;
import
org.apache.skywalking.apm.plugin.jdbc.trace.SWPreparedStatement
;
/**
* {@link JDBCPrepareStatementWithArrayInterceptor} return {@link SWPreparedStatement} instance that wrapper the real
* preparedStatement instance when the client call <code>oracle.jdbc.driver.PhysicalConnection#prepareStatement(String,
* int[])</code> method or <code>oracle.jdbc.driver.PhysicalConnection#prepareStatement(String, String[])</code>
* method.
*
* @author zhangxin
*/
public
class
JDBCPrepareStatementWithArrayInterceptor
implements
InstanceMethodsAroundInterceptor
{
public
class
CreateCallableInterceptor
implements
InstanceMethodsAroundInterceptor
{
@Override
public
void
beforeMethod
(
EnhancedInstance
objInst
,
Method
method
,
Object
[]
allArguments
,
Class
<?>[]
argumentsTypes
,
MethodInterceptResult
result
)
throws
Throwable
{
...
...
@@ -45,19 +35,10 @@ public class JDBCPrepareStatementWithArrayInterceptor implements InstanceMethods
@Override
public
Object
afterMethod
(
EnhancedInstance
objInst
,
Method
method
,
Object
[]
allArguments
,
Class
<?>[]
argumentsTypes
,
Object
ret
)
throws
Throwable
{
/**
* To prevent the <code>org.postgresql.jdbc.prepareStatement(String sql)</code> method from repeating
* interceptor, Because PGConnection call <code>org.postgresql.jdbc.prepareStatement(String sql)</code> method when
* the second argument is empty.
*
* @see oracle.jdbc.driver.PhysicalConnection#prepareStatement(String, int[])
* @see oracle.jdbc.driver.PhysicalConnection#prepareStatement(String, String[])
**/
String
sql
=
(
String
)
allArguments
[
0
];
if
(!
AutoKeyInfo
.
isInsertSqlStmt
(
sql
))
{
return
ret
;
if
(
ret
instanceof
EnhancedInstance
)
{
((
EnhancedInstance
)
ret
).
setSkyWalkingDynamicField
(
new
StatementEnhanceInfos
((
ConnectionInfo
)
objInst
.
getSkyWalkingDynamicField
(),
(
String
)
allArguments
[
0
],
"CallableStatement"
));
}
return
new
SWPreparedStatement
((
Connection
)
objInst
,
(
PreparedStatement
)
ret
,
(
ConnectionInfo
)
objInst
.
getSkyWalkingDynamicField
(),
(
String
)
allArguments
[
0
])
;
return
ret
;
}
@Override
public
void
handleMethodException
(
EnhancedInstance
objInst
,
Method
method
,
Object
[]
allArguments
,
...
...
apm-sniffer/apm-sdk-plugin/oracle-10.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jdbc/oracle/CreatePreparedStatementInterceptor.java
0 → 100644
浏览文件 @
7554cfab
/*
* 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.oracle
;
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/oracle-10.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jdbc/oracle/CreateStatementInterceptor.java
0 → 100644
浏览文件 @
7554cfab
/*
* 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.oracle
;
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/oracle-10.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jdbc/oracle/PreparedStatementExecuteMethodsInterceptor.java
0 → 100644
浏览文件 @
7554cfab
/*
* 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.oracle
;
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.define.StatementEnhanceInfos
;
import
org.apache.skywalking.apm.plugin.jdbc.trace.ConnectionInfo
;
/**
* @author zhang xin
*/
public
class
PreparedStatementExecuteMethodsInterceptor
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
();
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
,
cacheObject
.
getSql
());
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
().
errorOccurred
().
log
(
t
);
}
}
private
String
buildOperationName
(
ConnectionInfo
connectionInfo
,
String
methodName
,
String
statementName
)
{
return
connectionInfo
.
getDBType
()
+
"/JDBI/"
+
statementName
+
"/"
+
methodName
;
}
}
apm-sniffer/apm-sdk-plugin/oracle-10.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jdbc/oracle/StatementExecuteMethodsInterceptor.java
0 → 100644
浏览文件 @
7554cfab
/*
* 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.oracle
;
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.define.StatementEnhanceInfos
;
import
org.apache.skywalking.apm.plugin.jdbc.trace.ConnectionInfo
;
public
class
StatementExecuteMethodsInterceptor
implements
InstanceMethodsAroundInterceptor
{
@Override
public
void
beforeMethod
(
EnhancedInstance
objInst
,
Method
method
,
Object
[]
allArguments
,
Class
<?>[]
argumentsTypes
,
MethodInterceptResult
result
)
throws
Throwable
{
StatementEnhanceInfos
cacheObject
=
(
StatementEnhanceInfos
)
objInst
.
getSkyWalkingDynamicField
();
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
());
String
sql
=
""
;
if
(
allArguments
.
length
>
0
)
{
sql
=
(
String
)
allArguments
[
0
];
}
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
().
errorOccurred
().
log
(
t
);
}
}
private
String
buildOperationName
(
ConnectionInfo
connectionInfo
,
String
methodName
,
String
statementName
)
{
return
connectionInfo
.
getDBType
()
+
"/JDBI/"
+
statementName
+
"/"
+
methodName
;
}
}
apm-sniffer/apm-sdk-plugin/oracle-10.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jdbc/oracle/define/ConnectionInstrumentation.java
浏览文件 @
7554cfab
...
...
@@ -16,12 +16,10 @@
*
*/
package
org.apache.skywalking.apm.plugin.jdbc.oracle.define
;
import
net.bytebuddy.description.method.MethodDescription
;
import
net.bytebuddy.matcher.ElementMatcher
;
import
org.apache.skywalking.apm.agent.core.plugin.bytebuddy.ArgumentTypeNameMatch
;
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
;
...
...
@@ -33,28 +31,23 @@ import static net.bytebuddy.matcher.ElementMatchers.named;
import
static
net
.
bytebuddy
.
matcher
.
ElementMatchers
.
takesArguments
;
/**
* {@link ConnectionInstrumentation} intercept the following methods that the class which extend {@link
* oracle.jdbc.driver.PhysicalConnection}. <br/>
*
* 1. Enhance <code>prepareStatement</code> by <code>org.apache.skywalking.apm.plugin.jdbc.define.JDBCPrepareStatementInterceptor</code>
* 2. Enhance <code>prepareStatement</code> that the seconds argument type is <code>java.lang.String[]</code> by
* <code>oracle.jdbc.driver.JDBCPrepareStatementWithArrayInterceptor</code>
* 3. Enhance <code>prepareStatement</code> that the seconds argument type is <code>int[]</code> by
* <code>oracle.jdbc.driver.JDBCPrepareStatementWithArrayInterceptor</code>
* 4. Enhance <code>prepareCall</code> by
* <code>org.apache.skywalking.apm.plugin.jdbc.define.JDBCPrepareCallInterceptor</code>
* 5. Enhance <code>createStatement</code>
* by <code>org.apache.skywalking.apm.plugin.jdbc.define.JDBCStatementInterceptor</code>
* 6. Enhance <code>commit, rollback, close, releaseSavepoint</code> by <code>org.apache.skywalking.apm.plugin.jdbc.define.ConnectionServiceMethodInterceptor</code>
* {@link ConnectionInstrumentation} define that the oracle plugin intercept the following methods that the class which
* extend {@link oracle.jdbc.driver.PhysicalConnection}. <br/>
* <pre>
* 1. Enhance <code>prepareStatement</code> by <code>org.apache.skywalking.apm.plugin.jdbc.oracle.CreatePreparedStatementInterceptor</code>
* 2. Enhance <code>prepareCall</code> by <code>org.apache.skywalking.apm.plugin.jdbc.oracle.CreateCallableInterceptor</code>
* 3. Enhance <code>createStatement</code> by <code>org.apache.skywalking.apm.plugin.jdbc.oracle.CreateStatementInterceptor</code>
* 4. Enhance <code>commit, rollback, close, releaseSavepoint</code> by <code>org.apache.skywalking.apm.plugin.jdbc.define.ConnectionServiceMethodInterceptor</code>
* </pre>
*
* @author zhangxin
*/
public
class
ConnectionInstrumentation
extends
ClassInstanceMethodsEnhancePluginDefine
{
private
static
final
String
PREPARE_STATEMENT_METHOD_WITH_ARRAY_INTERCEPTOR_CLASS
=
"oracle.jdbc.driver.JDBCPrepareStatementWithArrayInterceptor"
;
public
static
final
String
ENHANCE_CLASS
=
"oracle.jdbc.driver.PhysicalConnection"
;
public
static
final
String
STRING_ARRAY_ARGUMENT_TYPE
=
"java.lang.String[]"
;
public
static
final
String
INT_ARRAY_ARGUMENT_TYPE
=
"int[]"
;
public
static
final
String
PREPARED_STATEMENT_INTERCEPT_CLASS
=
"org.apache.skywalking.apm.plugin.jdbc.oracle.CreatePreparedStatementInterceptor"
;
public
static
final
String
CALLABLE_INTERCEPT_CLASS
=
"org.apache.skywalking.apm.plugin.jdbc.oracle.CreateCallableInterceptor"
;
public
static
final
String
CREATE_STATEMENT_INTERCEPT_CLASS
=
"org.apache.skywalking.apm.plugin.jdbc.oracle.CreateStatementInterceptor"
;
@Override
protected
ConstructorInterceptPoint
[]
getConstructorsInterceptPoints
()
{
return
new
ConstructorInterceptPoint
[
0
];
...
...
@@ -64,37 +57,11 @@ public class ConnectionInstrumentation extends ClassInstanceMethodsEnhancePlugin
return
new
InstanceMethodsInterceptPoint
[]
{
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
(
ArgumentTypeNameMatch
.
takesArgumentWithType
(
1
,
STRING_ARRAY_ARGUMENT_TYPE
));
}
@Override
public
String
getMethodsInterceptor
()
{
return
PREPARE_STATEMENT_METHOD_WITH_ARRAY_INTERCEPTOR_CLASS
;
}
@Override
public
boolean
isOverrideArgs
()
{
return
false
;
}
},
new
InstanceMethodsInterceptPoint
()
{
@Override
public
ElementMatcher
<
MethodDescription
>
getMethodsMatcher
()
{
return
named
(
Constants
.
PREPARE_STATEMENT_METHOD_NAME
).
and
(
ArgumentTypeNameMatch
.
takesArgumentWithType
(
1
,
INT_ARRAY_ARGUMENT_TYPE
));
return
named
(
Constants
.
PREPARE_STATEMENT_METHOD_NAME
);
}
@Override
public
String
getMethodsInterceptor
()
{
return
PREPARE
_STATEMENT_METHOD_WITH_ARRAY_INTERCEPTOR
_CLASS
;
return
PREPARE
D_STATEMENT_INTERCEPT
_CLASS
;
}
@Override
public
boolean
isOverrideArgs
()
{
...
...
@@ -107,7 +74,7 @@ public class ConnectionInstrumentation extends ClassInstanceMethodsEnhancePlugin
}
@Override
public
String
getMethodsInterceptor
()
{
return
C
onstants
.
PREPARE_CALL
_INTERCEPT_CLASS
;
return
C
ALLABLE
_INTERCEPT_CLASS
;
}
@Override
public
boolean
isOverrideArgs
()
{
...
...
@@ -120,7 +87,7 @@ public class ConnectionInstrumentation extends ClassInstanceMethodsEnhancePlugin
}
@Override
public
String
getMethodsInterceptor
()
{
return
C
onstants
.
C
REATE_STATEMENT_INTERCEPT_CLASS
;
return
CREATE_STATEMENT_INTERCEPT_CLASS
;
}
@Override
public
boolean
isOverrideArgs
()
{
...
...
apm-sniffer/apm-sdk-plugin/oracle-10.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jdbc/oracle/define/OracleCallableInstrumentation.java
0 → 100644
浏览文件 @
7554cfab
/*
* 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.oracle.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
static
net
.
bytebuddy
.
matcher
.
ElementMatchers
.
named
;
import
static
org
.
apache
.
skywalking
.
apm
.
agent
.
core
.
plugin
.
match
.
NameMatch
.
byName
;
import
static
org
.
apache
.
skywalking
.
apm
.
plugin
.
jdbc
.
oracle
.
Constants
.
PREPARED_STATEMENT_INTERCEPT_CLASS
;
/**
* {@link OracleCallableInstrumentation} define that the oracle plugin intercept the <code>execute, executeQuery and
* executeUpdate</code> method in {@link oracle.jdbc.driver.OracleCallableStatement} class by ${@link
* org.apache.skywalking.apm.plugin.jdbc.oracle.StatementExecuteMethodsInterceptor}
*
* @author zhangxin
*/
public
class
OracleCallableInstrumentation
extends
ClassInstanceMethodsEnhancePluginDefine
{
public
static
final
String
ENHANCE_CLASS
=
"oracle.jdbc.driver.OracleCallableStatement"
;
@Override
protected
ConstructorInterceptPoint
[]
getConstructorsInterceptPoints
()
{
return
new
ConstructorInterceptPoint
[
0
];
}
@Override
protected
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
PREPARED_STATEMENT_INTERCEPT_CLASS
;
}
@Override
public
boolean
isOverrideArgs
()
{
return
false
;
}
}
};
}
@Override
protected
ClassMatch
enhanceClass
()
{
return
byName
(
ENHANCE_CLASS
);
}
}
apm-sniffer/apm-sdk-plugin/oracle-10.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jdbc/oracle/define/OraclePrepareStatementInstrumentation.java
0 → 100644
浏览文件 @
7554cfab
/*
* 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.oracle.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
static
net
.
bytebuddy
.
matcher
.
ElementMatchers
.
named
;
import
static
org
.
apache
.
skywalking
.
apm
.
agent
.
core
.
plugin
.
match
.
NameMatch
.
byName
;
import
static
org
.
apache
.
skywalking
.
apm
.
plugin
.
jdbc
.
oracle
.
Constants
.
PREPARED_STATEMENT_INTERCEPT_CLASS
;
/**
* {@link OraclePrepareStatementInstrumentation} define that the oracle plugin intercept the <code>execute,
* executeQuery, executeUpdate and executeLargeUpdate</code> method in {@link oracle.jdbc.driver.OraclePreparedStatement}
* class by ${@link org.apache.skywalking.apm.plugin.jdbc.oracle.StatementExecuteMethodsInterceptor}
*
* @author zhangxin
*/
public
class
OraclePrepareStatementInstrumentation
extends
ClassInstanceMethodsEnhancePluginDefine
{
public
static
final
String
ENHANCE_CLASS
=
"oracle.jdbc.driver.OraclePreparedStatement"
;
@Override
protected
ConstructorInterceptPoint
[]
getConstructorsInterceptPoints
()
{
return
new
ConstructorInterceptPoint
[
0
];
}
@Override
protected
InstanceMethodsInterceptPoint
[]
getInstanceMethodsInterceptPoints
()
{
return
new
InstanceMethodsInterceptPoint
[]
{
new
InstanceMethodsInterceptPoint
()
{
@Override
public
ElementMatcher
<
MethodDescription
>
getMethodsMatcher
()
{
return
named
(
"execute"
)
.
or
(
named
(
"executeQuery"
))
.
or
(
named
(
"executeUpdate"
))
.
or
(
named
(
"executeLargeUpdate"
));
}
@Override
public
String
getMethodsInterceptor
()
{
return
PREPARED_STATEMENT_INTERCEPT_CLASS
;
}
@Override
public
boolean
isOverrideArgs
()
{
return
false
;
}
}
};
}
@Override
protected
ClassMatch
enhanceClass
()
{
return
byName
(
ENHANCE_CLASS
);
}
}
apm-sniffer/apm-sdk-plugin/oracle-10.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jdbc/oracle/define/OracleStatementInstrumentation.java
0 → 100644
浏览文件 @
7554cfab
/*
* 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.oracle.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
static
net
.
bytebuddy
.
matcher
.
ElementMatchers
.
named
;
import
static
org
.
apache
.
skywalking
.
apm
.
agent
.
core
.
plugin
.
match
.
NameMatch
.
byName
;
import
static
org
.
apache
.
skywalking
.
apm
.
plugin
.
jdbc
.
oracle
.
Constants
.
STATEMENT_INTERCEPT_CLASS
;
/**
* {@link OracleStatementInstrumentation} define that the oracle plugin intercept the <code>execute, executeQuery,
* executeUpdate and executeLargeUpdate</code> method in {@link oracle.jdbc.driver.OracleStatement} class by ${@link
* org.apache.skywalking.apm.plugin.jdbc.oracle.StatementExecuteMethodsInterceptor}
*
* @author zhangxin
*/
public
class
OracleStatementInstrumentation
extends
ClassInstanceMethodsEnhancePluginDefine
{
public
static
final
String
ENHANCE_CLASS
=
"oracle.jdbc.driver.OracleStatement"
;
@Override
protected
ConstructorInterceptPoint
[]
getConstructorsInterceptPoints
()
{
return
new
ConstructorInterceptPoint
[
0
];
}
@Override
protected
InstanceMethodsInterceptPoint
[]
getInstanceMethodsInterceptPoints
()
{
return
new
InstanceMethodsInterceptPoint
[]
{
new
InstanceMethodsInterceptPoint
()
{
@Override
public
ElementMatcher
<
MethodDescription
>
getMethodsMatcher
()
{
return
named
(
"execute"
)
.
or
(
named
(
"executeQuery"
))
.
or
(
named
(
"executeUpdate"
))
.
or
(
named
(
"executeLargeUpdate"
))
.
or
(
named
(
"executeBatchInternal"
))
.
or
(
named
(
"executeUpdateInternal"
))
.
or
(
named
(
"executeQuery"
));
}
@Override
public
String
getMethodsInterceptor
()
{
return
STATEMENT_INTERCEPT_CLASS
;
}
@Override
public
boolean
isOverrideArgs
()
{
return
false
;
}
}
};
}
@Override
protected
ClassMatch
enhanceClass
()
{
return
byName
(
ENHANCE_CLASS
);
}
}
apm-sniffer/apm-sdk-plugin/oracle-10.x-plugin/src/main/resources/skywalking-plugin.def
浏览文件 @
7554cfab
oracle-10.x=org.apache.skywalking.apm.plugin.jdbc.oracle.define.DriverInstrumentation
oracle-10.x=org.apache.skywalking.apm.plugin.jdbc.oracle.define.ConnectionInstrumentation
oracle-10.x=org.apache.skywalking.apm.plugin.jdbc.oracle.define.OracleCallableInstrumentation
oracle-10.x=org.apache.skywalking.apm.plugin.jdbc.oracle.define.OraclePrepareStatementInstrumentation
oracle-10.x=org.apache.skywalking.apm.plugin.jdbc.oracle.define.OracleStatementInstrumentation
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录