mirror of
https://github.com/wahyd4/pinpoint.git
synced 2026-08-18 01:06:03 +10:00
[유치수] [profiler-48] add ibatis, mybatis interceptor on/off configuration
git-svn-id: http://svn.bds.nhncorp.com/pe/hippo-tomcat-profiler/trunk@4047 84d0f5b1-2673-498c-a247-62c4ff18d310
This commit is contained in:
+19
-1
@@ -11,13 +11,17 @@ import com.nhn.pinpoint.common.ServiceType;
|
||||
|
||||
/**
|
||||
* @author Hyun Jeong
|
||||
* @author netspider
|
||||
*/
|
||||
public abstract class SqlMapOperationInterceptor implements SimpleAroundInterceptor, ByteCodeMethodDescriptorSupport, TraceContextSupport {
|
||||
|
||||
private final ServiceType serviceType;
|
||||
|
||||
private MethodDescriptor descriptor;
|
||||
private TraceContext traceContext;
|
||||
|
||||
protected TraceContext traceContext;
|
||||
|
||||
protected boolean enabled = true;
|
||||
|
||||
public SqlMapOperationInterceptor(ServiceType serviceType) {
|
||||
this.serviceType = serviceType;
|
||||
@@ -25,8 +29,17 @@ public abstract class SqlMapOperationInterceptor implements SimpleAroundIntercep
|
||||
|
||||
protected abstract PLogger getLogger();
|
||||
|
||||
protected abstract void initConfig();
|
||||
|
||||
@Override
|
||||
public final void before(Object target, Object[] args) {
|
||||
if (!enabled) {
|
||||
if (getLogger().isDebugEnabled()) {
|
||||
getLogger().debug("interceptor is disabled.");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (getLogger().isDebugEnabled()) {
|
||||
getLogger().beforeInterceptor(target, args);
|
||||
}
|
||||
@@ -41,6 +54,10 @@ public abstract class SqlMapOperationInterceptor implements SimpleAroundIntercep
|
||||
|
||||
@Override
|
||||
public final void after(Object target, Object[] args, Object result) {
|
||||
if (!enabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (getLogger().isDebugEnabled()) {
|
||||
getLogger().afterInterceptor(target, args, result);
|
||||
}
|
||||
@@ -66,6 +83,7 @@ public abstract class SqlMapOperationInterceptor implements SimpleAroundIntercep
|
||||
@Override
|
||||
public final void setTraceContext(TraceContext traceContext) {
|
||||
this.traceContext = traceContext;
|
||||
this.initConfig();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+11
@@ -1,5 +1,6 @@
|
||||
package com.nhn.pinpoint.profiler.modifier.orm.ibatis.interceptor;
|
||||
|
||||
import com.nhn.pinpoint.bootstrap.config.ProfilerConfig;
|
||||
import com.nhn.pinpoint.bootstrap.logging.PLogger;
|
||||
import com.nhn.pinpoint.bootstrap.logging.PLoggerFactory;
|
||||
import com.nhn.pinpoint.common.ServiceType;
|
||||
@@ -7,6 +8,7 @@ import com.nhn.pinpoint.profiler.modifier.orm.SqlMapOperationInterceptor;
|
||||
|
||||
/**
|
||||
* @author Hyun Jeong
|
||||
* @author netspider
|
||||
*/
|
||||
public class IbatisSqlMapOperationInterceptor extends SqlMapOperationInterceptor {
|
||||
|
||||
@@ -21,4 +23,13 @@ public class IbatisSqlMapOperationInterceptor extends SqlMapOperationInterceptor
|
||||
return this.logger;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initConfig() {
|
||||
if (traceContext != null) {
|
||||
final ProfilerConfig config = traceContext.getProfilerConfig();
|
||||
if (config != null) {
|
||||
this.enabled = config.isIBatisEnabled();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+11
@@ -1,5 +1,6 @@
|
||||
package com.nhn.pinpoint.profiler.modifier.orm.mybatis.interceptor;
|
||||
|
||||
import com.nhn.pinpoint.bootstrap.config.ProfilerConfig;
|
||||
import com.nhn.pinpoint.bootstrap.logging.PLogger;
|
||||
import com.nhn.pinpoint.bootstrap.logging.PLoggerFactory;
|
||||
import com.nhn.pinpoint.common.ServiceType;
|
||||
@@ -7,6 +8,7 @@ import com.nhn.pinpoint.profiler.modifier.orm.SqlMapOperationInterceptor;
|
||||
|
||||
/**
|
||||
* @author Hyun Jeong
|
||||
* @author netspider
|
||||
*/
|
||||
public class MyBatisSqlMapOperationInterceptor extends SqlMapOperationInterceptor {
|
||||
|
||||
@@ -21,4 +23,13 @@ public class MyBatisSqlMapOperationInterceptor extends SqlMapOperationIntercepto
|
||||
return this.logger;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initConfig() {
|
||||
if (traceContext != null) {
|
||||
final ProfilerConfig config = traceContext.getProfilerConfig();
|
||||
if (config != null) {
|
||||
this.enabled = config.isMyBatisEnabled();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -149,3 +149,15 @@ profiler.arcus.keytrace=true
|
||||
profiler.memcached=true
|
||||
profiler.memcached.keytrace=true
|
||||
|
||||
|
||||
###########################################################
|
||||
# ibatis #
|
||||
###########################################################
|
||||
profiler.orm.ibatis=true
|
||||
|
||||
|
||||
###########################################################
|
||||
# mybatis #
|
||||
###########################################################
|
||||
profiler.orm.mybatis=true
|
||||
|
||||
|
||||
@@ -157,3 +157,15 @@ profiler.arcus.keytrace=true
|
||||
profiler.memcached=true
|
||||
profiler.memcached.keytrace=true
|
||||
|
||||
|
||||
###########################################################
|
||||
# ibatis #
|
||||
###########################################################
|
||||
profiler.orm.ibatis=true
|
||||
|
||||
|
||||
###########################################################
|
||||
# mybatis #
|
||||
###########################################################
|
||||
profiler.orm.mybatis=true
|
||||
|
||||
|
||||
@@ -150,3 +150,15 @@ profiler.arcus.keytrace=false
|
||||
profiler.memcached=true
|
||||
profiler.memcached.keytrace=false
|
||||
|
||||
|
||||
###########################################################
|
||||
# ibatis #
|
||||
###########################################################
|
||||
profiler.orm.ibatis=true
|
||||
|
||||
|
||||
###########################################################
|
||||
# mybatis #
|
||||
###########################################################
|
||||
profiler.orm.mybatis=true
|
||||
|
||||
|
||||
Reference in New Issue
Block a user