未验证 提交 91386d43 编写于 作者: wu-sheng's avatar wu-sheng 提交者: GitHub

Merge pull request #637 from ascrutae/fix/support-postgresql-plugin

Change the mechanism of postgresql plugin
......@@ -16,7 +16,7 @@
* Project repository: https://github.com/OpenSkywalking/skywalking
*/
package org.skywalking.apm.plugin.jdbc.mysql.define;
package org.skywalking.apm.plugin.jdbc.define;
import org.skywalking.apm.plugin.jdbc.trace.ConnectionInfo;
......
......@@ -22,7 +22,7 @@ import java.lang.reflect.Method;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult;
import org.skywalking.apm.plugin.jdbc.mysql.define.StatementEnhanceInfos;
import org.skywalking.apm.plugin.jdbc.define.StatementEnhanceInfos;
import org.skywalking.apm.plugin.jdbc.trace.ConnectionInfo;
/**
......
......@@ -22,7 +22,7 @@ import java.lang.reflect.Method;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult;
import org.skywalking.apm.plugin.jdbc.mysql.define.StatementEnhanceInfos;
import org.skywalking.apm.plugin.jdbc.define.StatementEnhanceInfos;
import org.skywalking.apm.plugin.jdbc.trace.ConnectionInfo;
/**
......
......@@ -22,7 +22,7 @@ import java.lang.reflect.Method;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult;
import org.skywalking.apm.plugin.jdbc.mysql.define.StatementEnhanceInfos;
import org.skywalking.apm.plugin.jdbc.define.StatementEnhanceInfos;
import org.skywalking.apm.plugin.jdbc.trace.ConnectionInfo;
/**
......
......@@ -26,7 +26,7 @@ import org.skywalking.apm.agent.core.context.trace.SpanLayer;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult;
import org.skywalking.apm.plugin.jdbc.mysql.define.StatementEnhanceInfos;
import org.skywalking.apm.plugin.jdbc.define.StatementEnhanceInfos;
import org.skywalking.apm.plugin.jdbc.trace.ConnectionInfo;
/**
......
......@@ -37,7 +37,7 @@ import org.skywalking.apm.agent.test.tools.SegmentStoragePoint;
import org.skywalking.apm.agent.test.tools.SpanAssert;
import org.skywalking.apm.agent.test.tools.TracingSegmentRunner;
import org.skywalking.apm.network.trace.component.ComponentsDefine;
import org.skywalking.apm.plugin.jdbc.mysql.define.StatementEnhanceInfos;
import org.skywalking.apm.plugin.jdbc.define.StatementEnhanceInfos;
import org.skywalking.apm.plugin.jdbc.trace.ConnectionInfo;
import static org.hamcrest.CoreMatchers.is;
......
/*
* 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.postgresql;
import java.lang.reflect.Method;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult;
import org.skywalking.apm.plugin.jdbc.define.StatementEnhanceInfos;
import org.skywalking.apm.plugin.jdbc.trace.ConnectionInfo;
/**
* {@link CreateStatementInterceptor} intercepts the {@link org.postgresql.jdbc.PgConnection#prepareCall} method in
* {@link org.postgresql.jdbc.PgConnection}, {@link org.postgresql.jdbc.PgConnection} or {@link org.postgresql.jdbc3.Jdbc3Connection} class.
*
* @author zhangxin
*/
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) {
}
}
/*
* 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.postgresql;
import java.lang.reflect.Method;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult;
import org.skywalking.apm.plugin.jdbc.define.StatementEnhanceInfos;
import org.skywalking.apm.plugin.jdbc.trace.ConnectionInfo;
/**
* {@link CreatePreparedStatementInterceptor} intercepts the {@link org.postgresql.jdbc.PgConnection#prepareStatement} method in
* {@link org.postgresql.jdbc.PgConnection}, {@link org.postgresql.jdbc.PgConnection} or {@link org.postgresql.jdbc3.Jdbc3Connection} class.
*
* @author zhangxin
*/
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) {
}
}
/*
* 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.postgresql;
import java.lang.reflect.Method;
import org.postgresql.jdbc.PgConnection;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult;
import org.skywalking.apm.plugin.jdbc.define.StatementEnhanceInfos;
import org.skywalking.apm.plugin.jdbc.trace.ConnectionInfo;
/**
* {@link CreateStatementInterceptor} intercepts the {@link PgConnection#createStatement} method in
* {@link org.postgresql.jdbc.PgConnection}, {@link org.postgresql.jdbc.PgConnection} or {@link org.postgresql.jdbc3.Jdbc3Connection} class.
*
* @author zhangxin
*/
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(), "", "CallableStatement"));
}
return ret;
}
@Override public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments,
Class<?>[] argumentsTypes, Throwable t) {
}
}
/*
* 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.postgresql;
import java.lang.reflect.Method;
import org.skywalking.apm.agent.core.context.ContextManager;
import org.skywalking.apm.agent.core.context.tag.Tags;
import org.skywalking.apm.agent.core.context.trace.AbstractSpan;
import org.skywalking.apm.agent.core.context.trace.SpanLayer;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor;
import org.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult;
import org.skywalking.apm.plugin.jdbc.define.StatementEnhanceInfos;
import org.skywalking.apm.plugin.jdbc.trace.ConnectionInfo;
/**
* {@link StatementExecuteMethodsInterceptor} create the exit span when the client call the interceptor methods.
*
* @author zhangxin
*/
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();
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;
}
}
/*
* 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.postgresql.define;
import net.bytebuddy.description.method.MethodDescription;
import net.bytebuddy.matcher.ElementMatcher;
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.enhance.ClassInstanceMethodsEnhancePluginDefine;
import org.skywalking.apm.agent.core.plugin.match.ClassMatch;
import static net.bytebuddy.matcher.ElementMatchers.named;
import static net.bytebuddy.matcher.ElementMatchers.takesArguments;
import static org.skywalking.apm.agent.core.plugin.match.NameMatch.byName;
/**
* {@link AbstractJdbc2StatementInstrumentation} intercept the following methods that the class which extend {@link
* org.postgresql.jdbc2.AbstractJdbc2Statement} by {@link org.skywalking.apm.plugin.jdbc.postgresql.StatementExecuteMethodsInterceptor}. <br/>
* 1. the <code>execute</code> with non parameter
* 2. the <code>execute</code> with one parameter
* 3. the <code>executeBatch</code>
* 4. the <code>executeQuery</code> with non parameter
* 5. the <code>executeQuery</code> with one parameter
* 6. the <code>executeUpdate</code> with non parameter
* 7. the <code>executeUpdate</code> with one parameter
* 8. the <code>addBatch</code> with non parameter
* 9. the <code>addBatch</code> with one parameter
*
* @author zhangxin
*/
public class AbstractJdbc2StatementInstrumentation extends ClassInstanceMethodsEnhancePluginDefine {
private static final String ENHANCE_CLASS = "org.postgresql.jdbc2.AbstractJdbc2Statement";
private static final String INTERCEPTOR_CLASS = "org.skywalking.apm.plugin.jdbc.postgresql.StatementExecuteMethodsInterceptor";
@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").and(takesArguments(0))
.or(named("execute").and(takesArguments(1)))
.or(named("executeBatch"))
.or(named("executeQuery").and(takesArguments(0)))
.or(named("executeQuery").and(takesArguments(1)))
.or(named("executeUpdate").and(takesArguments(0)))
.or(named("executeUpdate").and(takesArguments(1)))
.or(named("addBatch").and(takesArguments(1)))
.or(named("addBatch").and(takesArguments(0)));
}
@Override public String getMethodsInterceptor() {
return INTERCEPTOR_CLASS;
}
@Override public boolean isOverrideArgs() {
return false;
}
}
};
}
@Override protected ClassMatch enhanceClass() {
return byName(ENHANCE_CLASS);
}
}
......@@ -31,15 +31,15 @@ import static org.skywalking.apm.agent.core.plugin.bytebuddy.ArgumentTypeNameMat
import static org.skywalking.apm.agent.core.plugin.match.NameMatch.byName;
import static org.skywalking.apm.plugin.jdbc.define.Constants.CLOSE_METHOD_NAME;
import static org.skywalking.apm.plugin.jdbc.define.Constants.COMMIT_METHOD_NAME;
import static org.skywalking.apm.plugin.jdbc.define.Constants.CREATE_STATEMENT_INTERCEPT_CLASS;
import static org.skywalking.apm.plugin.jdbc.define.Constants.CREATE_STATEMENT_METHOD_NAME;
import static org.skywalking.apm.plugin.jdbc.define.Constants.PREPARE_CALL_INTERCEPT_CLASS;
import static org.skywalking.apm.plugin.jdbc.define.Constants.PREPARE_CALL_METHOD_NAME;
import static org.skywalking.apm.plugin.jdbc.define.Constants.PREPARE_STATEMENT_INTERCEPT_CLASS;
import static org.skywalking.apm.plugin.jdbc.define.Constants.PREPARE_STATEMENT_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.SERVICE_METHOD_INTERCEPT_CLASS;
import static org.skywalking.apm.plugin.jdbc.postgresql.define.Constants.CREATE_CALLABLE_STATEMENT_INTERCEPTOR_CLASS;
import static org.skywalking.apm.plugin.jdbc.postgresql.define.Constants.CREATE_PREPARED_STATEMENT_INTERCEPTOR_CLASS;
import static org.skywalking.apm.plugin.jdbc.postgresql.define.Constants.CREATE_STATEMENT_INTERCEPTOR_CLASS;
/**
* {@link ConnectionInstrumentation} intercept the following methods that the class which extend {@link
......@@ -74,7 +74,7 @@ public class ConnectionInstrumentation extends ClassInstanceMethodsEnhancePlugin
}
@Override public String getMethodsInterceptor() {
return PREPARE_STATEMENT_INTERCEPT_CLASS;
return CREATE_PREPARED_STATEMENT_INTERCEPTOR_CLASS;
}
@Override public boolean isOverrideArgs() {
......@@ -100,7 +100,7 @@ public class ConnectionInstrumentation extends ClassInstanceMethodsEnhancePlugin
}
@Override public String getMethodsInterceptor() {
return PREPARE_CALL_INTERCEPT_CLASS;
return CREATE_CALLABLE_STATEMENT_INTERCEPTOR_CLASS;
}
@Override public boolean isOverrideArgs() {
......@@ -113,7 +113,7 @@ public class ConnectionInstrumentation extends ClassInstanceMethodsEnhancePlugin
}
@Override public String getMethodsInterceptor() {
return CREATE_STATEMENT_INTERCEPT_CLASS;
return CREATE_STATEMENT_INTERCEPTOR_CLASS;
}
@Override public boolean isOverrideArgs() {
......
/*
* 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.postgresql.define;
/**
* Interceptor class name constant variable
*
* @author zhangxin
*/
public class Constants {
public static final String CREATE_STATEMENT_INTERCEPTOR_CLASS = "org.skywalking.apm.plugin.jdbc.postgresql.CreateStatementInterceptor";
public static final String CREATE_PREPARED_STATEMENT_INTERCEPTOR_CLASS = "org.skywalking.apm.plugin.jdbc.postgresql.CreatePreparedStatementInterceptor";
public static final String CREATE_CALLABLE_STATEMENT_INTERCEPTOR_CLASS = "org.skywalking.apm.plugin.jdbc.postgresql.CreateCallableStatementInterceptor";
}
......@@ -30,15 +30,15 @@ import static net.bytebuddy.matcher.ElementMatchers.takesArguments;
import static org.skywalking.apm.agent.core.plugin.match.NameMatch.byName;
import static org.skywalking.apm.plugin.jdbc.define.Constants.CLOSE_METHOD_NAME;
import static org.skywalking.apm.plugin.jdbc.define.Constants.COMMIT_METHOD_NAME;
import static org.skywalking.apm.plugin.jdbc.define.Constants.CREATE_STATEMENT_INTERCEPT_CLASS;
import static org.skywalking.apm.plugin.jdbc.define.Constants.CREATE_STATEMENT_METHOD_NAME;
import static org.skywalking.apm.plugin.jdbc.define.Constants.PREPARE_CALL_INTERCEPT_CLASS;
import static org.skywalking.apm.plugin.jdbc.define.Constants.PREPARE_CALL_METHOD_NAME;
import static org.skywalking.apm.plugin.jdbc.define.Constants.PREPARE_STATEMENT_INTERCEPT_CLASS;
import static org.skywalking.apm.plugin.jdbc.define.Constants.PREPARE_STATEMENT_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.SERVICE_METHOD_INTERCEPT_CLASS;
import static org.skywalking.apm.plugin.jdbc.postgresql.define.Constants.CREATE_CALLABLE_STATEMENT_INTERCEPTOR_CLASS;
import static org.skywalking.apm.plugin.jdbc.postgresql.define.Constants.CREATE_PREPARED_STATEMENT_INTERCEPTOR_CLASS;
import static org.skywalking.apm.plugin.jdbc.postgresql.define.Constants.CREATE_STATEMENT_INTERCEPTOR_CLASS;
/**
* {@link Jdbc3ConnectionInstrumentation} intercept the following methods that the class which extend {@link
......@@ -69,7 +69,7 @@ public class Jdbc3ConnectionInstrumentation extends ClassInstanceMethodsEnhanceP
}
@Override public String getMethodsInterceptor() {
return PREPARE_STATEMENT_INTERCEPT_CLASS;
return CREATE_PREPARED_STATEMENT_INTERCEPTOR_CLASS;
}
@Override public boolean isOverrideArgs() {
......@@ -82,7 +82,7 @@ public class Jdbc3ConnectionInstrumentation extends ClassInstanceMethodsEnhanceP
}
@Override public String getMethodsInterceptor() {
return PREPARE_CALL_INTERCEPT_CLASS;
return CREATE_CALLABLE_STATEMENT_INTERCEPTOR_CLASS;
}
@Override public boolean isOverrideArgs() {
......@@ -95,7 +95,7 @@ public class Jdbc3ConnectionInstrumentation extends ClassInstanceMethodsEnhanceP
}
@Override public String getMethodsInterceptor() {
return CREATE_STATEMENT_INTERCEPT_CLASS;
return CREATE_STATEMENT_INTERCEPTOR_CLASS;
}
@Override public boolean isOverrideArgs() {
......@@ -104,7 +104,8 @@ public class Jdbc3ConnectionInstrumentation extends ClassInstanceMethodsEnhanceP
},
new InstanceMethodsInterceptPoint() {
@Override public ElementMatcher<MethodDescription> getMethodsMatcher() {
return named(COMMIT_METHOD_NAME).or(named(ROLLBACK_METHOD_NAME)).or(named(CLOSE_METHOD_NAME)).or(named(RELEASE_SAVE_POINT_METHOD_NAME));
return named(COMMIT_METHOD_NAME).or(named(ROLLBACK_METHOD_NAME)).or(named(CLOSE_METHOD_NAME))
.or(named(RELEASE_SAVE_POINT_METHOD_NAME));
}
@Override public String getMethodsInterceptor() {
......
......@@ -32,13 +32,13 @@ import static org.skywalking.apm.plugin.jdbc.define.Constants.CLOSE_METHOD_NAME;
import static org.skywalking.apm.plugin.jdbc.define.Constants.COMMIT_METHOD_NAME;
import static org.skywalking.apm.plugin.jdbc.define.Constants.CREATE_STATEMENT_INTERCEPT_CLASS;
import static org.skywalking.apm.plugin.jdbc.define.Constants.CREATE_STATEMENT_METHOD_NAME;
import static org.skywalking.apm.plugin.jdbc.define.Constants.PREPARE_CALL_INTERCEPT_CLASS;
import static org.skywalking.apm.plugin.jdbc.define.Constants.PREPARE_CALL_METHOD_NAME;
import static org.skywalking.apm.plugin.jdbc.define.Constants.PREPARE_STATEMENT_INTERCEPT_CLASS;
import static org.skywalking.apm.plugin.jdbc.define.Constants.PREPARE_STATEMENT_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.SERVICE_METHOD_INTERCEPT_CLASS;
import static org.skywalking.apm.plugin.jdbc.postgresql.define.Constants.CREATE_CALLABLE_STATEMENT_INTERCEPTOR_CLASS;
import static org.skywalking.apm.plugin.jdbc.postgresql.define.Constants.CREATE_PREPARED_STATEMENT_INTERCEPTOR_CLASS;
/**
* {@link Jdbc4ConnectionInstrumentation} intercept the following methods that the class which extend {@link
......@@ -69,7 +69,7 @@ public class Jdbc4ConnectionInstrumentation extends ClassInstanceMethodsEnhanceP
}
@Override public String getMethodsInterceptor() {
return PREPARE_STATEMENT_INTERCEPT_CLASS;
return CREATE_PREPARED_STATEMENT_INTERCEPTOR_CLASS;
}
@Override public boolean isOverrideArgs() {
......@@ -82,7 +82,7 @@ public class Jdbc4ConnectionInstrumentation extends ClassInstanceMethodsEnhanceP
}
@Override public String getMethodsInterceptor() {
return PREPARE_CALL_INTERCEPT_CLASS;
return CREATE_CALLABLE_STATEMENT_INTERCEPTOR_CLASS;
}
@Override public boolean isOverrideArgs() {
......
......@@ -2,3 +2,4 @@ postgresql-8.x=org.skywalking.apm.plugin.jdbc.postgresql.define.DriverInstrument
postgresql-8.x=org.skywalking.apm.plugin.jdbc.postgresql.define.Jdbc3ConnectionInstrumentation
postgresql-8.x=org.skywalking.apm.plugin.jdbc.postgresql.define.Jdbc4ConnectionInstrumentation
postgresql-8.x=org.skywalking.apm.plugin.jdbc.postgresql.define.ConnectionInstrumentation
postgresql-8.x=org.skywalking.apm.plugin.jdbc.postgresql.define.AbstractJdbc2StatementInstrumentation
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册