[강운덕] [LUCYSUS-1744] preparedStatement생성은 다른 thread에서도 할수 있으므로 traceContext내에서 하면 안됨.

- remotecall에 sampling flag:fasle를 넣어도 샘플링 대상이 되는 문제가 있어 추가 수정이 필요함.

git-svn-id: http://svn.bds.nhncorp.com/pe/hippo-tomcat-profiler/trunk@1566 84d0f5b1-2673-498c-a247-62c4ff18d310
This commit is contained in:
Woonduk Kang
2013-04-25 10:26:59 +00:00
parent 78e57e6320
commit fd81d1b397
4 changed files with 12 additions and 9 deletions
@@ -50,7 +50,7 @@ public class Execute2MethodInterceptor implements StaticAroundInterceptor, ByteC
final boolean sampling = trace.canSampled();
if (!sampling) {
if(isDebug) {
logger.debug("set Samplingflag= ");
logger.debug("set Sampling flag=false");
}
request.addHeader(Header.HTTP_SAMPLED.toString(), SamplingFlagUtils.SAMPLING_RATE_FALSE);
return;
@@ -50,6 +50,9 @@ public class ExecuteMethodInterceptor implements StaticAroundInterceptor, ByteCo
final HttpRequest request = (HttpRequest) args[1];
final boolean sampling = trace.canSampled();
if (!sampling) {
if(isDebug) {
logger.debug("set Sampling flag=false");
}
request.addHeader(Header.HTTP_SAMPLED.toString(), SamplingFlagUtils.SAMPLING_RATE_FALSE);
return;
}
@@ -64,6 +64,12 @@ public class PreparedStatementCreateInterceptor implements StaticAroundIntercept
logger.debug("internal jdbc scope. skip trace");
return;
}
boolean success = InterceptorUtils.isSuccess(result);
if(success) {
// preparedStatement의 생성이 성공하였을 경우만 PreparedStatement에 databaseInfo를 세팅해야 한다.
DatabaseInfo databaseInfo = (DatabaseInfo) getUrl.invoke(target);
this.setUrl.invoke(result, databaseInfo);
}
Trace trace = traceContext.currentTraceObject();
if (trace == null) {
@@ -73,14 +79,7 @@ public class PreparedStatementCreateInterceptor implements StaticAroundIntercept
String sql = (String) args[0];
// 성공하였을 때만 PreparedSteatement에 Parsing Result를 넣어야 한다.
ParsingResult parsingResult = trace.recordSqlInfo(sql);
boolean success = InterceptorUtils.isSuccess(result);
if (success) {
// preparedStatement의 생성이 성공하였을 경우만 PreparedStatement에 databaseInfo를 세팅해야 한다.
DatabaseInfo databaseInfo = (DatabaseInfo) getUrl.invoke(target);
this.setUrl.invoke(result, databaseInfo);
if (parsingResult != null) {
this.setSql.invoke(result, parsingResult);
}
@@ -72,9 +72,10 @@ public class StandardHostValveInvokeInterceptor implements StaticAroundIntercept
trace = traceContext.newTraceObject();
if (!trace.canSampled()){
logger.debug("TraceID not exist. camSampled is false. skip trace. requestUrl:{}, remoteAddr:{}", new Object[] {requestURL, remoteAddr });
return;
} else {
if (isDebug) {
logger.debug("TraceID not exist. start new trace. requestUrl:{}, remoteAddr:{}", new Object[] { requestURL, remoteAddr });
logger.debug("TraceID not exist. start new trace. traceId:{} requestUrl:{}, remoteAddr:{}", new Object[] { traceId, requestURL, remoteAddr });
}
}
}