mirror of
https://github.com/wahyd4/pinpoint.git
synced 2026-08-09 04:46:06 +10:00
@@ -14,16 +14,18 @@
|
||||
*/
|
||||
package com.navercorp.pinpoint.plugin.cxf;
|
||||
|
||||
import java.security.ProtectionDomain;
|
||||
|
||||
import com.navercorp.pinpoint.bootstrap.instrument.InstrumentClass;
|
||||
import com.navercorp.pinpoint.bootstrap.instrument.InstrumentException;
|
||||
import com.navercorp.pinpoint.bootstrap.instrument.InstrumentMethod;
|
||||
import com.navercorp.pinpoint.bootstrap.instrument.Instrumentor;
|
||||
import com.navercorp.pinpoint.bootstrap.instrument.transformer.TransformCallback;
|
||||
import com.navercorp.pinpoint.bootstrap.instrument.transformer.TransformTemplate;
|
||||
import com.navercorp.pinpoint.bootstrap.instrument.transformer.TransformTemplateAware;
|
||||
import com.navercorp.pinpoint.bootstrap.plugin.ProfilerPlugin;
|
||||
import com.navercorp.pinpoint.bootstrap.plugin.ProfilerPluginSetupContext;
|
||||
import com.navercorp.pinpoint.bootstrap.plugin.util.InstrumentUtils;
|
||||
|
||||
import java.security.ProtectionDomain;
|
||||
|
||||
/**
|
||||
* @author barney
|
||||
@@ -52,8 +54,9 @@ public class CxfPlugin implements ProfilerPlugin, TransformTemplateAware {
|
||||
throws InstrumentException {
|
||||
InstrumentClass target = instrumentor.getInstrumentClass(classLoader, className, classfileBuffer);
|
||||
|
||||
target.getDeclaredMethod("invokeSync", "java.lang.reflect.Method", "org.apache.cxf.service.model.BindingOperationInfo", "java.lang.Object[]")
|
||||
.addInterceptor("com.navercorp.pinpoint.plugin.cxf.interceptor.CxfClientInvokeSyncMethodInterceptor");
|
||||
// invokeSyncMethod
|
||||
InstrumentMethod invokeSyncMethod = InstrumentUtils.findMethod(target, "invokeSync", new String[]{"java.lang.reflect.Method", "org.apache.cxf.service.model.BindingOperationInfo", "java.lang.Object[]"});
|
||||
invokeSyncMethod.addScopedInterceptor("com.navercorp.pinpoint.plugin.cxf.interceptor.CxfClientInvokeSyncMethodInterceptor", CxfPluginConstants.CXF_CLIENT_SCOPE);
|
||||
|
||||
return target.toBytecode();
|
||||
}
|
||||
|
||||
+4
-6
@@ -14,27 +14,25 @@
|
||||
*/
|
||||
package com.navercorp.pinpoint.plugin.cxf.interceptor;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import com.navercorp.pinpoint.bootstrap.context.MethodDescriptor;
|
||||
import com.navercorp.pinpoint.bootstrap.context.SpanEventRecorder;
|
||||
import com.navercorp.pinpoint.bootstrap.context.Trace;
|
||||
import com.navercorp.pinpoint.bootstrap.context.TraceContext;
|
||||
import com.navercorp.pinpoint.bootstrap.context.TraceId;
|
||||
import com.navercorp.pinpoint.bootstrap.interceptor.AroundInterceptor;
|
||||
import com.navercorp.pinpoint.bootstrap.interceptor.annotation.Scope;
|
||||
import com.navercorp.pinpoint.bootstrap.logging.PLogger;
|
||||
import com.navercorp.pinpoint.bootstrap.logging.PLoggerFactory;
|
||||
import com.navercorp.pinpoint.plugin.cxf.CxfPluginConfig;
|
||||
import com.navercorp.pinpoint.plugin.cxf.CxfPluginConstants;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* @author barney
|
||||
*
|
||||
*/
|
||||
@Scope(CxfPluginConstants.CXF_CLIENT_SCOPE)
|
||||
public class CxfClientInvokeSyncMethodInterceptor implements AroundInterceptor {
|
||||
|
||||
private final PLogger logger = PLoggerFactory.getLogger(this.getClass());
|
||||
|
||||
+21
-4
@@ -18,6 +18,7 @@ package com.navercorp.pinpoint.plugin.commons.dbcp;
|
||||
|
||||
import com.navercorp.pinpoint.bootstrap.instrument.InstrumentClass;
|
||||
import com.navercorp.pinpoint.bootstrap.instrument.InstrumentException;
|
||||
import com.navercorp.pinpoint.bootstrap.instrument.InstrumentMethod;
|
||||
import com.navercorp.pinpoint.bootstrap.instrument.Instrumentor;
|
||||
import com.navercorp.pinpoint.bootstrap.instrument.transformer.TransformCallback;
|
||||
import com.navercorp.pinpoint.bootstrap.instrument.transformer.TransformTemplate;
|
||||
@@ -26,6 +27,7 @@ import com.navercorp.pinpoint.bootstrap.logging.PLogger;
|
||||
import com.navercorp.pinpoint.bootstrap.logging.PLoggerFactory;
|
||||
import com.navercorp.pinpoint.bootstrap.plugin.ProfilerPlugin;
|
||||
import com.navercorp.pinpoint.bootstrap.plugin.ProfilerPluginSetupContext;
|
||||
import com.navercorp.pinpoint.bootstrap.plugin.util.InstrumentUtils;
|
||||
|
||||
import java.security.ProtectionDomain;
|
||||
|
||||
@@ -60,7 +62,11 @@ public class CommonsDbcpPlugin implements ProfilerPlugin, TransformTemplateAware
|
||||
@Override
|
||||
public byte[] doInTransform(Instrumentor instrumentor, ClassLoader loader, String className, Class<?> classBeingRedefined, ProtectionDomain protectionDomain, byte[] classfileBuffer) throws InstrumentException {
|
||||
InstrumentClass target = instrumentor.getInstrumentClass(loader, className, classfileBuffer);
|
||||
target.addInterceptor(CommonsDbcpConstants.INTERCEPTOR_CLOSE_CONNECTION);
|
||||
|
||||
// closeMethod
|
||||
InstrumentMethod closeMethod = InstrumentUtils.findMethod(target, "close");
|
||||
closeMethod.addScopedInterceptor(CommonsDbcpConstants.INTERCEPTOR_CLOSE_CONNECTION, CommonsDbcpConstants.SCOPE);
|
||||
|
||||
return target.toBytecode();
|
||||
}
|
||||
});
|
||||
@@ -75,11 +81,22 @@ public class CommonsDbcpPlugin implements ProfilerPlugin, TransformTemplateAware
|
||||
|
||||
if (isAvailableDataSourceMonitor(target)) {
|
||||
target.addField(CommonsDbcpConstants.ACCESSOR_DATASOURCE_MONITOR);
|
||||
target.addInterceptor(CommonsDbcpConstants.INTERCEPTOR_CONSTRUCTOR);
|
||||
target.addInterceptor(CommonsDbcpConstants.INTERCEPTOR_CLOSE);
|
||||
|
||||
// default constructor
|
||||
InstrumentMethod defaultConstructor = InstrumentUtils.findConstructor(target);
|
||||
defaultConstructor.addScopedInterceptor(CommonsDbcpConstants.INTERCEPTOR_CONSTRUCTOR, CommonsDbcpConstants.SCOPE);
|
||||
|
||||
// closeMethod
|
||||
InstrumentMethod closeMethod = InstrumentUtils.findMethod(target, "close");
|
||||
closeMethod.addScopedInterceptor(CommonsDbcpConstants.INTERCEPTOR_CLOSE, CommonsDbcpConstants.SCOPE);
|
||||
}
|
||||
|
||||
target.addInterceptor(CommonsDbcpConstants.INTERCEPTOR_GET_CONNECTION);
|
||||
// getConnectionMethod
|
||||
InstrumentMethod getConnectionMethod = InstrumentUtils.findMethod(target, "getConnection");
|
||||
getConnectionMethod.addScopedInterceptor(CommonsDbcpConstants.INTERCEPTOR_GET_CONNECTION, CommonsDbcpConstants.SCOPE);
|
||||
getConnectionMethod = InstrumentUtils.findMethod(target, "getConnection", new String[]{"java.lang.String", "java.lang.String"});
|
||||
getConnectionMethod.addScopedInterceptor(CommonsDbcpConstants.INTERCEPTOR_GET_CONNECTION, CommonsDbcpConstants.SCOPE);
|
||||
|
||||
return target.toBytecode();
|
||||
}
|
||||
});
|
||||
|
||||
-4
@@ -20,16 +20,12 @@ import com.navercorp.pinpoint.bootstrap.context.MethodDescriptor;
|
||||
import com.navercorp.pinpoint.bootstrap.context.SpanEventRecorder;
|
||||
import com.navercorp.pinpoint.bootstrap.context.TraceContext;
|
||||
import com.navercorp.pinpoint.bootstrap.interceptor.SpanEventSimpleAroundInterceptorForPlugin;
|
||||
import com.navercorp.pinpoint.bootstrap.interceptor.annotation.Scope;
|
||||
import com.navercorp.pinpoint.bootstrap.interceptor.annotation.TargetMethod;
|
||||
import com.navercorp.pinpoint.plugin.commons.dbcp.CommonsDbcpConstants;
|
||||
|
||||
/**
|
||||
* Maybe we should trace get of Datasource.
|
||||
* @author emeroad
|
||||
*/
|
||||
@Scope(CommonsDbcpConstants.SCOPE)
|
||||
@TargetMethod(name="close")
|
||||
public class DataSourceCloseConnectionInterceptor extends SpanEventSimpleAroundInterceptorForPlugin {
|
||||
|
||||
public DataSourceCloseConnectionInterceptor(TraceContext traceContext, MethodDescriptor descriptor) {
|
||||
|
||||
-5
@@ -19,18 +19,13 @@ package com.navercorp.pinpoint.plugin.commons.dbcp.interceptor;
|
||||
import com.navercorp.pinpoint.bootstrap.context.MethodDescriptor;
|
||||
import com.navercorp.pinpoint.bootstrap.context.TraceContext;
|
||||
import com.navercorp.pinpoint.bootstrap.interceptor.AroundInterceptor;
|
||||
import com.navercorp.pinpoint.bootstrap.interceptor.annotation.Scope;
|
||||
import com.navercorp.pinpoint.bootstrap.interceptor.annotation.TargetMethod;
|
||||
import com.navercorp.pinpoint.bootstrap.plugin.monitor.DataSourceMonitorRegistry;
|
||||
import com.navercorp.pinpoint.plugin.commons.dbcp.CommonsDbcpConstants;
|
||||
import com.navercorp.pinpoint.plugin.commons.dbcp.DataSourceMonitorAccessor;
|
||||
import com.navercorp.pinpoint.plugin.commons.dbcp.DbcpDataSourceMonitor;
|
||||
|
||||
/**
|
||||
* @author Taejin Koo
|
||||
*/
|
||||
@Scope(CommonsDbcpConstants.SCOPE)
|
||||
@TargetMethod(name="close")
|
||||
public class DataSourceCloseInterceptor implements AroundInterceptor {
|
||||
|
||||
private final TraceContext traceContext;
|
||||
|
||||
-5
@@ -17,11 +17,8 @@
|
||||
package com.navercorp.pinpoint.plugin.commons.dbcp.interceptor;
|
||||
|
||||
import com.navercorp.pinpoint.bootstrap.interceptor.AroundInterceptor;
|
||||
import com.navercorp.pinpoint.bootstrap.interceptor.annotation.Scope;
|
||||
import com.navercorp.pinpoint.bootstrap.interceptor.annotation.TargetConstructor;
|
||||
import com.navercorp.pinpoint.bootstrap.plugin.monitor.DataSourceMonitorRegistry;
|
||||
import com.navercorp.pinpoint.bootstrap.util.InterceptorUtils;
|
||||
import com.navercorp.pinpoint.plugin.commons.dbcp.CommonsDbcpConstants;
|
||||
import com.navercorp.pinpoint.plugin.commons.dbcp.DataSourceMonitorAccessor;
|
||||
import com.navercorp.pinpoint.plugin.commons.dbcp.DbcpDataSourceMonitor;
|
||||
import org.apache.commons.dbcp.BasicDataSource;
|
||||
@@ -29,8 +26,6 @@ import org.apache.commons.dbcp.BasicDataSource;
|
||||
/**
|
||||
* @author Taejin Koo
|
||||
*/
|
||||
@Scope(CommonsDbcpConstants.SCOPE)
|
||||
@TargetConstructor
|
||||
public class DataSourceConstructorInterceptor implements AroundInterceptor {
|
||||
|
||||
private final DataSourceMonitorRegistry dataSourceMonitorRegistry;
|
||||
|
||||
-8
@@ -20,20 +20,12 @@ import com.navercorp.pinpoint.bootstrap.context.MethodDescriptor;
|
||||
import com.navercorp.pinpoint.bootstrap.context.SpanEventRecorder;
|
||||
import com.navercorp.pinpoint.bootstrap.context.TraceContext;
|
||||
import com.navercorp.pinpoint.bootstrap.interceptor.SpanEventSimpleAroundInterceptorForPlugin;
|
||||
import com.navercorp.pinpoint.bootstrap.interceptor.annotation.Scope;
|
||||
import com.navercorp.pinpoint.bootstrap.interceptor.annotation.TargetMethod;
|
||||
import com.navercorp.pinpoint.bootstrap.interceptor.annotation.TargetMethods;
|
||||
import com.navercorp.pinpoint.plugin.commons.dbcp.CommonsDbcpConstants;
|
||||
|
||||
/**
|
||||
* Maybe we should trace get of Datasource.
|
||||
* @author emeroad
|
||||
*/
|
||||
@Scope(CommonsDbcpConstants.SCOPE)
|
||||
@TargetMethods({
|
||||
@TargetMethod(name="getConnection"),
|
||||
@TargetMethod(name="getConnection", paramTypes={"java.lang.String", "java.lang.String"})
|
||||
})
|
||||
public class DataSourceGetConnectionInterceptor extends SpanEventSimpleAroundInterceptorForPlugin {
|
||||
|
||||
public DataSourceGetConnectionInterceptor(TraceContext traceContext, MethodDescriptor descriptor) {
|
||||
|
||||
+21
-4
@@ -18,6 +18,7 @@ package com.navercorp.pinpoint.plugin.commons.dbcp2;
|
||||
|
||||
import com.navercorp.pinpoint.bootstrap.instrument.InstrumentClass;
|
||||
import com.navercorp.pinpoint.bootstrap.instrument.InstrumentException;
|
||||
import com.navercorp.pinpoint.bootstrap.instrument.InstrumentMethod;
|
||||
import com.navercorp.pinpoint.bootstrap.instrument.Instrumentor;
|
||||
import com.navercorp.pinpoint.bootstrap.instrument.transformer.TransformCallback;
|
||||
import com.navercorp.pinpoint.bootstrap.instrument.transformer.TransformTemplate;
|
||||
@@ -26,6 +27,7 @@ import com.navercorp.pinpoint.bootstrap.logging.PLogger;
|
||||
import com.navercorp.pinpoint.bootstrap.logging.PLoggerFactory;
|
||||
import com.navercorp.pinpoint.bootstrap.plugin.ProfilerPlugin;
|
||||
import com.navercorp.pinpoint.bootstrap.plugin.ProfilerPluginSetupContext;
|
||||
import com.navercorp.pinpoint.bootstrap.plugin.util.InstrumentUtils;
|
||||
|
||||
import java.security.ProtectionDomain;
|
||||
|
||||
@@ -57,7 +59,11 @@ public class CommonsDbcp2Plugin implements ProfilerPlugin, TransformTemplateAwar
|
||||
@Override
|
||||
public byte[] doInTransform(Instrumentor instrumentor, ClassLoader loader, String className, Class<?> classBeingRedefined, ProtectionDomain protectionDomain, byte[] classfileBuffer) throws InstrumentException {
|
||||
InstrumentClass target = instrumentor.getInstrumentClass(loader, className, classfileBuffer);
|
||||
target.addInterceptor(CommonsDbcp2Constants.INTERCEPTOR_CLOSE_CONNECTION);
|
||||
|
||||
// closeMethod
|
||||
InstrumentMethod closeMethod = InstrumentUtils.findMethod(target, "close");
|
||||
closeMethod.addScopedInterceptor(CommonsDbcp2Constants.INTERCEPTOR_CLOSE_CONNECTION, CommonsDbcp2Constants.SCOPE);
|
||||
|
||||
return target.toBytecode();
|
||||
}
|
||||
});
|
||||
@@ -72,11 +78,22 @@ public class CommonsDbcp2Plugin implements ProfilerPlugin, TransformTemplateAwar
|
||||
|
||||
if (isAvailableDataSourceMonitor(target)) {
|
||||
target.addField(CommonsDbcp2Constants.ACCESSOR_DATASOURCE_MONITOR);
|
||||
target.addInterceptor(CommonsDbcp2Constants.INTERCEPTOR_CONSTRUCTOR);
|
||||
target.addInterceptor(CommonsDbcp2Constants.INTERCEPTOR_CLOSE);
|
||||
|
||||
// closeMethod
|
||||
InstrumentMethod closeMethod = InstrumentUtils.findMethod(target, "close");
|
||||
closeMethod.addScopedInterceptor(CommonsDbcp2Constants.INTERCEPTOR_CLOSE, CommonsDbcp2Constants.SCOPE);
|
||||
|
||||
// constructor
|
||||
InstrumentMethod defaultConstructor = InstrumentUtils.findConstructor(target);
|
||||
defaultConstructor.addScopedInterceptor(CommonsDbcp2Constants.INTERCEPTOR_CONSTRUCTOR, CommonsDbcp2Constants.SCOPE);
|
||||
}
|
||||
|
||||
target.addInterceptor(CommonsDbcp2Constants.INTERCEPTOR_GET_CONNECTION);
|
||||
// getConnectionMethod
|
||||
InstrumentMethod getConnectionMethod = InstrumentUtils.findMethod(target, "getConnection");
|
||||
getConnectionMethod.addScopedInterceptor(CommonsDbcp2Constants.INTERCEPTOR_GET_CONNECTION, CommonsDbcp2Constants.SCOPE);
|
||||
getConnectionMethod = InstrumentUtils.findMethod(target, "getConnection", new String[]{"java.lang.String", "java.lang.String"});
|
||||
getConnectionMethod.addScopedInterceptor(CommonsDbcp2Constants.INTERCEPTOR_GET_CONNECTION, CommonsDbcp2Constants.SCOPE);
|
||||
|
||||
return target.toBytecode();
|
||||
}
|
||||
});
|
||||
|
||||
-4
@@ -20,12 +20,8 @@ import com.navercorp.pinpoint.bootstrap.context.MethodDescriptor;
|
||||
import com.navercorp.pinpoint.bootstrap.context.SpanEventRecorder;
|
||||
import com.navercorp.pinpoint.bootstrap.context.TraceContext;
|
||||
import com.navercorp.pinpoint.bootstrap.interceptor.SpanEventSimpleAroundInterceptorForPlugin;
|
||||
import com.navercorp.pinpoint.bootstrap.interceptor.annotation.Scope;
|
||||
import com.navercorp.pinpoint.bootstrap.interceptor.annotation.TargetMethod;
|
||||
import com.navercorp.pinpoint.plugin.commons.dbcp2.CommonsDbcp2Constants;
|
||||
|
||||
@Scope(CommonsDbcp2Constants.SCOPE)
|
||||
@TargetMethod(name="close")
|
||||
public class DataSourceCloseConnectionInterceptor extends SpanEventSimpleAroundInterceptorForPlugin {
|
||||
|
||||
public DataSourceCloseConnectionInterceptor(TraceContext traceContext, MethodDescriptor descriptor) {
|
||||
|
||||
-5
@@ -19,18 +19,13 @@ package com.navercorp.pinpoint.plugin.commons.dbcp2.interceptor;
|
||||
import com.navercorp.pinpoint.bootstrap.context.MethodDescriptor;
|
||||
import com.navercorp.pinpoint.bootstrap.context.TraceContext;
|
||||
import com.navercorp.pinpoint.bootstrap.interceptor.AroundInterceptor;
|
||||
import com.navercorp.pinpoint.bootstrap.interceptor.annotation.Scope;
|
||||
import com.navercorp.pinpoint.bootstrap.interceptor.annotation.TargetMethod;
|
||||
import com.navercorp.pinpoint.bootstrap.plugin.monitor.DataSourceMonitorRegistry;
|
||||
import com.navercorp.pinpoint.plugin.commons.dbcp2.CommonsDbcp2Constants;
|
||||
import com.navercorp.pinpoint.plugin.commons.dbcp2.DataSourceMonitorAccessor;
|
||||
import com.navercorp.pinpoint.plugin.commons.dbcp2.Dbcp2DataSourceMonitor;
|
||||
|
||||
/**
|
||||
* @author Taejin Koo
|
||||
*/
|
||||
@Scope(CommonsDbcp2Constants.SCOPE)
|
||||
@TargetMethod(name="close")
|
||||
public class DataSourceCloseInterceptor implements AroundInterceptor {
|
||||
|
||||
private final TraceContext traceContext;
|
||||
|
||||
-5
@@ -17,11 +17,8 @@
|
||||
package com.navercorp.pinpoint.plugin.commons.dbcp2.interceptor;
|
||||
|
||||
import com.navercorp.pinpoint.bootstrap.interceptor.AroundInterceptor;
|
||||
import com.navercorp.pinpoint.bootstrap.interceptor.annotation.Scope;
|
||||
import com.navercorp.pinpoint.bootstrap.interceptor.annotation.TargetConstructor;
|
||||
import com.navercorp.pinpoint.bootstrap.plugin.monitor.DataSourceMonitorRegistry;
|
||||
import com.navercorp.pinpoint.bootstrap.util.InterceptorUtils;
|
||||
import com.navercorp.pinpoint.plugin.commons.dbcp2.CommonsDbcp2Constants;
|
||||
import com.navercorp.pinpoint.plugin.commons.dbcp2.DataSourceMonitorAccessor;
|
||||
import com.navercorp.pinpoint.plugin.commons.dbcp2.Dbcp2DataSourceMonitor;
|
||||
import org.apache.commons.dbcp2.BasicDataSource;
|
||||
@@ -29,8 +26,6 @@ import org.apache.commons.dbcp2.BasicDataSource;
|
||||
/**
|
||||
* @author Taejin Koo
|
||||
*/
|
||||
@Scope(CommonsDbcp2Constants.SCOPE)
|
||||
@TargetConstructor
|
||||
public class DataSourceConstructorInterceptor implements AroundInterceptor {
|
||||
|
||||
private final DataSourceMonitorRegistry dataSourceMonitorRegistry;
|
||||
|
||||
+3
-8
@@ -20,16 +20,11 @@ import com.navercorp.pinpoint.bootstrap.context.MethodDescriptor;
|
||||
import com.navercorp.pinpoint.bootstrap.context.SpanEventRecorder;
|
||||
import com.navercorp.pinpoint.bootstrap.context.TraceContext;
|
||||
import com.navercorp.pinpoint.bootstrap.interceptor.SpanEventSimpleAroundInterceptorForPlugin;
|
||||
import com.navercorp.pinpoint.bootstrap.interceptor.annotation.Scope;
|
||||
import com.navercorp.pinpoint.bootstrap.interceptor.annotation.TargetMethod;
|
||||
import com.navercorp.pinpoint.bootstrap.interceptor.annotation.TargetMethods;
|
||||
import com.navercorp.pinpoint.plugin.commons.dbcp2.CommonsDbcp2Constants;
|
||||
|
||||
@Scope(CommonsDbcp2Constants.SCOPE)
|
||||
@TargetMethods({
|
||||
@TargetMethod(name="getConnection"),
|
||||
@TargetMethod(name="getConnection", paramTypes={"java.lang.String", "java.lang.String"})
|
||||
})
|
||||
/**
|
||||
* @author Taejin Koo
|
||||
*/
|
||||
public class DataSourceGetConnectionInterceptor extends SpanEventSimpleAroundInterceptorForPlugin {
|
||||
|
||||
public DataSourceGetConnectionInterceptor(TraceContext traceContext, MethodDescriptor descriptor) {
|
||||
|
||||
Reference in New Issue
Block a user