mirror of
https://github.com/wahyd4/pinpoint.git
synced 2026-08-16 08:16:15 +10:00
[강운덕] [LUCYSUS-1744] byteCodeInstrumentor.newInterceptor()를 통해서 생성하던 interceptor를 직접 생성하도록 수정함. jdbc interceptor은 cl관련 클래스를 로드하지 않으므로 그냥 생성해도 됨.
git-svn-id: http://svn.bds.nhncorp.com/pe/hippo-tomcat-profiler/trunk@2385 84d0f5b1-2673-498c-a247-62c4ff18d310
This commit is contained in:
+7
-12
@@ -5,13 +5,13 @@ import java.security.ProtectionDomain;
|
||||
import com.nhn.pinpoint.profiler.Agent;
|
||||
import com.nhn.pinpoint.profiler.interceptor.Interceptor;
|
||||
import com.nhn.pinpoint.profiler.interceptor.ScopeDelegateSimpleInterceptor;
|
||||
import com.nhn.pinpoint.profiler.interceptor.SimpleAroundInterceptor;
|
||||
import com.nhn.pinpoint.profiler.interceptor.bci.ByteCodeInstrumentor;
|
||||
import com.nhn.pinpoint.profiler.interceptor.bci.InstrumentClass;
|
||||
import com.nhn.pinpoint.profiler.interceptor.bci.InstrumentException;
|
||||
import com.nhn.pinpoint.profiler.modifier.AbstractModifier;
|
||||
import com.nhn.pinpoint.profiler.modifier.db.interceptor.JDBCScope;
|
||||
import com.nhn.pinpoint.profiler.modifier.db.interceptor.StatementExecuteQueryInterceptor;
|
||||
import com.nhn.pinpoint.profiler.modifier.db.interceptor.StatementExecuteUpdateInterceptor;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@@ -38,21 +38,16 @@ public class CubridStatementModifier extends AbstractModifier {
|
||||
Interceptor executeQueryInterceptor = new ScopeDelegateSimpleInterceptor(new StatementExecuteQueryInterceptor(), JDBCScope.SCOPE);
|
||||
statementClass.addInterceptor("executeQuery", new String[] { "java.lang.String" }, executeQueryInterceptor);
|
||||
|
||||
// TODO 이거 고쳐야 됨.
|
||||
// 주석을 풀고 뭔가 고칠경우 ScopeDelegateSimpleInterceptor 로 감싸야한다.
|
||||
// Interceptor executeUpdate1 = byteCodeInstrumentor.newInterceptor(classLoader, protectedDomain, "com.nhn.pinpoint.profiler.modifier.db.interceptor.StatementExecuteUpdateInterceptor");
|
||||
// statementClass.addInterceptor("executeUpdate", new String[] { "java.lang.String" }, executeUpdate1);
|
||||
// 이거는 안해도 되나?
|
||||
// "executeUpdate", new String[] { "java.lang.String" }
|
||||
|
||||
SimpleAroundInterceptor executeUpdate = (SimpleAroundInterceptor) byteCodeInstrumentor.newInterceptor(classLoader, protectedDomain, "com.nhn.pinpoint.profiler.modifier.db.interceptor.StatementExecuteUpdateInterceptor");
|
||||
Interceptor executeUpdateInterceptor = new ScopeDelegateSimpleInterceptor(executeUpdate, JDBCScope.SCOPE);
|
||||
Interceptor executeUpdateInterceptor = new ScopeDelegateSimpleInterceptor(new StatementExecuteUpdateInterceptor(), JDBCScope.SCOPE);
|
||||
statementClass.addInterceptor("executeUpdate", new String[] { "java.lang.String", "int" }, executeUpdateInterceptor);
|
||||
|
||||
// 주석을 풀고 뭔가 고칠경우 ScopeDelegateSimpleInterceptor 로 감싸야한다.
|
||||
// Interceptor executeUpdate3 = byteCodeInstrumentor.newInterceptor(classLoader, protectedDomain, "com.nhn.pinpoint.profiler.modifier.db.interceptor.StatementExecuteUpdateInterceptor");
|
||||
// statementClass.addInterceptor("execute", new String[] { "java.lang.String" }, executeUpdate3);
|
||||
// 이거는 안해도 되나?
|
||||
// "execute", new String[] { "java.lang.String" }
|
||||
|
||||
SimpleAroundInterceptor execute = (SimpleAroundInterceptor) byteCodeInstrumentor.newInterceptor(classLoader, protectedDomain, "com.nhn.pinpoint.profiler.modifier.db.interceptor.StatementExecuteUpdateInterceptor");
|
||||
Interceptor executeInterceptor = new ScopeDelegateSimpleInterceptor(execute, JDBCScope.SCOPE);
|
||||
Interceptor executeInterceptor = new ScopeDelegateSimpleInterceptor(new StatementExecuteUpdateInterceptor(), JDBCScope.SCOPE);
|
||||
statementClass.addInterceptor("execute", new String[] { "java.lang.String", "int" }, executeInterceptor);
|
||||
|
||||
statementClass.addTraceVariable("__url", "__setUrl", "__getUrl", "java.lang.Object");
|
||||
|
||||
-12
@@ -66,18 +66,6 @@ public class MySQLPreparedStatementModifier extends AbstractModifier {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
// Interceptor interceptor = newInterceptor(classLoader, protectedDomain, "com.nhn.pinpoint.profiler.modifier.db.mysql.interceptor.ExecuteMethodInterceptor");
|
||||
// if (interceptor == null) {
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// byteCodeInstrumentor.checkLibrary(classLoader, javassistClassName);
|
||||
//
|
||||
// InstrumentClass aClass = byteCodeInstrumentor.getClass(javassistClassName);
|
||||
// aClass.addInterceptor("executeQuery", null, interceptor);
|
||||
|
||||
// return changeMethod(javassistClassName, classFileBuffer);
|
||||
}
|
||||
|
||||
private void bindVariableIntercept(InstrumentClass preparedStatement, ClassLoader classLoader, ProtectionDomain protectedDomain) throws InstrumentException {
|
||||
|
||||
+5
-9
@@ -5,7 +5,6 @@ import java.security.ProtectionDomain;
|
||||
import com.nhn.pinpoint.profiler.Agent;
|
||||
import com.nhn.pinpoint.profiler.interceptor.Interceptor;
|
||||
import com.nhn.pinpoint.profiler.interceptor.ScopeDelegateSimpleInterceptor;
|
||||
import com.nhn.pinpoint.profiler.interceptor.SimpleAroundInterceptor;
|
||||
import com.nhn.pinpoint.profiler.interceptor.bci.InstrumentException;
|
||||
import com.nhn.pinpoint.profiler.modifier.db.interceptor.JDBCScope;
|
||||
import com.nhn.pinpoint.profiler.modifier.db.interceptor.StatementExecuteQueryInterceptor;
|
||||
@@ -13,6 +12,7 @@ import com.nhn.pinpoint.profiler.modifier.db.interceptor.StatementExecuteQueryIn
|
||||
import com.nhn.pinpoint.profiler.interceptor.bci.ByteCodeInstrumentor;
|
||||
import com.nhn.pinpoint.profiler.interceptor.bci.InstrumentClass;
|
||||
import com.nhn.pinpoint.profiler.modifier.AbstractModifier;
|
||||
import com.nhn.pinpoint.profiler.modifier.db.interceptor.StatementExecuteUpdateInterceptor;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@@ -42,20 +42,16 @@ public class MySQLStatementModifier extends AbstractModifier {
|
||||
statementClass.addInterceptor("executeQuery", new String[]{"java.lang.String"}, interceptor);
|
||||
|
||||
// TODO 이거 고쳐야 됨.
|
||||
SimpleAroundInterceptor executeUpdate1 = (SimpleAroundInterceptor) byteCodeInstrumentor.newInterceptor(classLoader, protectedDomain, "com.nhn.pinpoint.profiler.modifier.db.interceptor.StatementExecuteUpdateInterceptor");
|
||||
Interceptor executeUpdateInterceptor1 = new ScopeDelegateSimpleInterceptor(executeUpdate1, JDBCScope.SCOPE);
|
||||
Interceptor executeUpdateInterceptor1 = new ScopeDelegateSimpleInterceptor(new StatementExecuteUpdateInterceptor(), JDBCScope.SCOPE);
|
||||
statementClass.addInterceptor("executeUpdate", new String[]{"java.lang.String"}, executeUpdateInterceptor1);
|
||||
|
||||
SimpleAroundInterceptor executeUpdate2 = (SimpleAroundInterceptor) byteCodeInstrumentor.newInterceptor(classLoader, protectedDomain, "com.nhn.pinpoint.profiler.modifier.db.interceptor.StatementExecuteUpdateInterceptor");
|
||||
Interceptor executeUpdateInterceptor2 = new ScopeDelegateSimpleInterceptor(executeUpdate2, JDBCScope.SCOPE);
|
||||
Interceptor executeUpdateInterceptor2 = new ScopeDelegateSimpleInterceptor(new StatementExecuteUpdateInterceptor(), JDBCScope.SCOPE);
|
||||
statementClass.addInterceptor("executeUpdate", new String[]{"java.lang.String", "int"}, executeUpdateInterceptor2);
|
||||
|
||||
SimpleAroundInterceptor executeUpdate3 = (SimpleAroundInterceptor) byteCodeInstrumentor.newInterceptor(classLoader, protectedDomain, "com.nhn.pinpoint.profiler.modifier.db.interceptor.StatementExecuteUpdateInterceptor");
|
||||
Interceptor executeUpdateInterceptor3 = new ScopeDelegateSimpleInterceptor(executeUpdate3, JDBCScope.SCOPE);
|
||||
Interceptor executeUpdateInterceptor3 = new ScopeDelegateSimpleInterceptor(new StatementExecuteUpdateInterceptor(), JDBCScope.SCOPE);
|
||||
statementClass.addInterceptor("execute", new String[]{"java.lang.String"}, executeUpdateInterceptor3);
|
||||
|
||||
SimpleAroundInterceptor executeUpdate4 = (SimpleAroundInterceptor) byteCodeInstrumentor.newInterceptor(classLoader, protectedDomain, "com.nhn.pinpoint.profiler.modifier.db.interceptor.StatementExecuteUpdateInterceptor");
|
||||
Interceptor executeUpdateInterceptor4 = new ScopeDelegateSimpleInterceptor(executeUpdate4, JDBCScope.SCOPE);
|
||||
Interceptor executeUpdateInterceptor4 = new ScopeDelegateSimpleInterceptor(new StatementExecuteUpdateInterceptor(), JDBCScope.SCOPE);
|
||||
statementClass.addInterceptor("execute", new String[]{"java.lang.String", "int"}, executeUpdateInterceptor4);
|
||||
|
||||
statementClass.addTraceVariable("__url", "__setUrl", "__getUrl", "java.lang.Object");
|
||||
|
||||
+3
-5
@@ -39,13 +39,11 @@ public class OracleDriverModifier extends AbstractModifier {
|
||||
|
||||
|
||||
Interceptor createConnection = new DriverConnectInterceptor();
|
||||
String[] params = new String[]{
|
||||
"java.lang.String", "java.util.Properties"
|
||||
};
|
||||
String[] params = new String[]{ "java.lang.String", "java.util.Properties" };
|
||||
oracleDriver.addInterceptor("connect", params, createConnection);
|
||||
|
||||
if (this.logger.isInfoEnabled()) {
|
||||
this.logger.info("{} class is converted.", javassistClassName);
|
||||
if (logger.isInfoEnabled()) {
|
||||
logger.info("{} class is converted.", javassistClassName);
|
||||
}
|
||||
|
||||
return oracleDriver.toBytecode();
|
||||
|
||||
+5
-9
@@ -3,13 +3,13 @@ package com.nhn.pinpoint.profiler.modifier.db.oracle;
|
||||
import com.nhn.pinpoint.profiler.Agent;
|
||||
import com.nhn.pinpoint.profiler.interceptor.Interceptor;
|
||||
import com.nhn.pinpoint.profiler.interceptor.ScopeDelegateSimpleInterceptor;
|
||||
import com.nhn.pinpoint.profiler.interceptor.SimpleAroundInterceptor;
|
||||
import com.nhn.pinpoint.profiler.interceptor.bci.ByteCodeInstrumentor;
|
||||
import com.nhn.pinpoint.profiler.interceptor.bci.InstrumentClass;
|
||||
import com.nhn.pinpoint.profiler.interceptor.bci.InstrumentException;
|
||||
import com.nhn.pinpoint.profiler.modifier.AbstractModifier;
|
||||
import com.nhn.pinpoint.profiler.modifier.db.interceptor.JDBCScope;
|
||||
import com.nhn.pinpoint.profiler.modifier.db.interceptor.StatementExecuteQueryInterceptor;
|
||||
import com.nhn.pinpoint.profiler.modifier.db.interceptor.StatementExecuteUpdateInterceptor;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@@ -40,21 +40,17 @@ public class OracleStatementWrapperModifier extends AbstractModifier {
|
||||
statementClass.addInterceptor("executeQuery", new String[]{"java.lang.String"}, executeQuery);
|
||||
|
||||
// TODO 이거 고쳐야 됨.
|
||||
SimpleAroundInterceptor executeUpdate1 = (SimpleAroundInterceptor) byteCodeInstrumentor.newInterceptor(classLoader, protectedDomain, "com.nhn.pinpoint.profiler.modifier.db.interceptor.StatementExecuteUpdateInterceptor");
|
||||
Interceptor executeUpdateInterceptor1 = new ScopeDelegateSimpleInterceptor(executeUpdate1, JDBCScope.SCOPE);
|
||||
Interceptor executeUpdateInterceptor1 = new ScopeDelegateSimpleInterceptor(new StatementExecuteUpdateInterceptor(), JDBCScope.SCOPE);
|
||||
statementClass.addInterceptor("executeUpdate", new String[]{"java.lang.String"}, executeUpdateInterceptor1);
|
||||
|
||||
|
||||
SimpleAroundInterceptor executeUpdate2= (SimpleAroundInterceptor) byteCodeInstrumentor.newInterceptor(classLoader, protectedDomain, "com.nhn.pinpoint.profiler.modifier.db.interceptor.StatementExecuteUpdateInterceptor");
|
||||
Interceptor executeUpdateInterceptor2 = new ScopeDelegateSimpleInterceptor(executeUpdate2, JDBCScope.SCOPE);
|
||||
Interceptor executeUpdateInterceptor2 = new ScopeDelegateSimpleInterceptor(new StatementExecuteUpdateInterceptor(), JDBCScope.SCOPE);
|
||||
statementClass.addInterceptor("executeUpdate", new String[]{"java.lang.String", "int"}, executeUpdateInterceptor2);
|
||||
|
||||
SimpleAroundInterceptor execute1 = (SimpleAroundInterceptor) byteCodeInstrumentor.newInterceptor(classLoader, protectedDomain, "com.nhn.pinpoint.profiler.modifier.db.interceptor.StatementExecuteUpdateInterceptor");
|
||||
Interceptor executeInterceptor1 = new ScopeDelegateSimpleInterceptor(execute1, JDBCScope.SCOPE);
|
||||
Interceptor executeInterceptor1 = new ScopeDelegateSimpleInterceptor(new StatementExecuteUpdateInterceptor(), JDBCScope.SCOPE);
|
||||
statementClass.addInterceptor("execute", new String[]{"java.lang.String"}, executeInterceptor1);
|
||||
|
||||
SimpleAroundInterceptor execute2 = (SimpleAroundInterceptor) byteCodeInstrumentor.newInterceptor(classLoader, protectedDomain, "com.nhn.pinpoint.profiler.modifier.db.interceptor.StatementExecuteUpdateInterceptor");
|
||||
Interceptor executeInterceptor2 = new ScopeDelegateSimpleInterceptor(execute2, JDBCScope.SCOPE);
|
||||
Interceptor executeInterceptor2 = new ScopeDelegateSimpleInterceptor(new StatementExecuteUpdateInterceptor(), JDBCScope.SCOPE);
|
||||
statementClass.addInterceptor("execute", new String[]{"java.lang.String", "int"}, executeInterceptor2);
|
||||
|
||||
statementClass.addTraceVariable("__url", "__setUrl", "__getUrl", "java.lang.Object");
|
||||
|
||||
Reference in New Issue
Block a user