mirror of
https://github.com/wahyd4/pinpoint.git
synced 2026-08-21 18:56:11 +10:00
[강운덕] [LUCYSUS-1744] AnnotationNames -> AnnotationKey로 변경.
git-svn-id: http://svn.bds.nhncorp.com/pe/hippo-tomcat-profiler/trunk@1192 84d0f5b1-2673-498c-a247-62c4ff18d310
This commit is contained in:
@@ -1,11 +1,8 @@
|
||||
package com.profiler.context;
|
||||
|
||||
import com.profiler.common.AnnotationNames;
|
||||
import com.profiler.common.AnnotationKey;
|
||||
import com.profiler.common.util.AnnotationTranscoder;
|
||||
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
/**
|
||||
* @author netspider
|
||||
*/
|
||||
@@ -14,22 +11,22 @@ public class Annotation implements Thriftable {
|
||||
private static final AnnotationTranscoder transcoder = new AnnotationTranscoder();
|
||||
|
||||
// private final long timestamp;
|
||||
private final AnnotationNames key;
|
||||
private final AnnotationKey key;
|
||||
|
||||
private final Object value;
|
||||
|
||||
|
||||
public Annotation(AnnotationNames key) {
|
||||
public Annotation(AnnotationKey key) {
|
||||
this.key = key;
|
||||
this.value = null;
|
||||
}
|
||||
|
||||
public Annotation(AnnotationNames key, Object value) {
|
||||
public Annotation(AnnotationKey key, Object value) {
|
||||
this.key = key;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public AnnotationNames getKey() {
|
||||
public AnnotationKey getKey() {
|
||||
return this.key;
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.profiler.common.AnnotationNames;
|
||||
import com.profiler.common.AnnotationKey;
|
||||
import com.profiler.common.ServiceType;
|
||||
import com.profiler.logging.LoggingUtils;
|
||||
|
||||
@@ -92,11 +92,11 @@ public class AsyncTrace {
|
||||
}
|
||||
|
||||
|
||||
public void recordAttribute(final AnnotationNames key, final String value) {
|
||||
public void recordAttribute(final AnnotationKey key, final String value) {
|
||||
recordAttibute(key, (Object) value);
|
||||
}
|
||||
|
||||
public void recordAttibute(final AnnotationNames key, final Object value) {
|
||||
public void recordAttibute(final AnnotationKey key, final Object value) {
|
||||
subSpan.addAnnotation(new Annotation(key, value));
|
||||
}
|
||||
|
||||
@@ -112,7 +112,7 @@ public class AsyncTrace {
|
||||
this.subSpan.setEndPoint(endPoint);
|
||||
}
|
||||
|
||||
private void annotate(final AnnotationNames key) {
|
||||
private void annotate(final AnnotationKey key) {
|
||||
this.subSpan.addAnnotation(new Annotation(key));
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.profiler.context;
|
||||
|
||||
import com.profiler.common.AnnotationNames;
|
||||
import com.profiler.common.AnnotationKey;
|
||||
import com.profiler.common.ServiceType;
|
||||
import com.profiler.common.util.ParsingResult;
|
||||
import com.profiler.interceptor.MethodDescriptor;
|
||||
@@ -196,7 +196,7 @@ public final class Trace {
|
||||
public void recordException(Object result) {
|
||||
if (result instanceof Throwable) {
|
||||
Throwable th = (Throwable) result;
|
||||
recordAttribute(AnnotationNames.EXCEPTION, th.getMessage());
|
||||
recordAttribute(AnnotationKey.EXCEPTION, th.getMessage());
|
||||
|
||||
Span span = getCallStack().getSpan();
|
||||
if (span.getException() == 0) {
|
||||
@@ -210,9 +210,9 @@ public final class Trace {
|
||||
return;
|
||||
}
|
||||
if (methodDescriptor.getApiId() == 0) {
|
||||
recordAttribute(AnnotationNames.API, methodDescriptor.getFullName());
|
||||
recordAttribute(AnnotationKey.API, methodDescriptor.getFullName());
|
||||
} else {
|
||||
recordAttribute(AnnotationNames.API_DID, methodDescriptor.getApiId());
|
||||
recordAttribute(AnnotationKey.API_DID, methodDescriptor.getApiId());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -223,26 +223,26 @@ public final class Trace {
|
||||
}
|
||||
|
||||
public void recordApi(int apiId) {
|
||||
recordAttribute(AnnotationNames.API_ID, apiId);
|
||||
recordAttribute(AnnotationKey.API_ID, apiId);
|
||||
}
|
||||
|
||||
public void recordApi(int apiId, Object[] args) {
|
||||
recordAttribute(AnnotationNames.API_ID, apiId);
|
||||
recordAttribute(AnnotationKey.API_ID, apiId);
|
||||
recocordArgs(args);
|
||||
}
|
||||
|
||||
private void recocordArgs(Object[] args) {
|
||||
if (args != null) {
|
||||
int min = Math.min(args.length, AnnotationNames.MAX_ARGS_SIZE);
|
||||
int min = Math.min(args.length, AnnotationKey.MAX_ARGS_SIZE);
|
||||
for (int i = 0; i < min; i++) {
|
||||
recordAttribute(AnnotationNames.getArgs(i), args[i]);
|
||||
recordAttribute(AnnotationKey.getArgs(i), args[i]);
|
||||
}
|
||||
// TODO MAX 사이즈를 넘는건 마크만 해줘야 하나?
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void recordAttribute(final AnnotationNames key, final String value) {
|
||||
public void recordAttribute(final AnnotationKey key, final String value) {
|
||||
recordAttribute(key, (Object) value);
|
||||
}
|
||||
|
||||
@@ -256,14 +256,14 @@ public final class Trace {
|
||||
}
|
||||
|
||||
public void recordSqlParsingResult(ParsingResult parsingResult) {
|
||||
recordAttribute(AnnotationNames.SQL_ID, parsingResult.getSql().hashCode());
|
||||
recordAttribute(AnnotationKey.SQL_ID, parsingResult.getSql().hashCode());
|
||||
String output = parsingResult.getOutput();
|
||||
if (output != null && output.length() != 0) {
|
||||
recordAttribute(AnnotationNames.SQL_PARAM, output);
|
||||
recordAttribute(AnnotationKey.SQL_PARAM, output);
|
||||
}
|
||||
}
|
||||
|
||||
public void recordAttribute(final AnnotationNames key, final Object value) {
|
||||
public void recordAttribute(final AnnotationKey key, final Object value) {
|
||||
// TODO API 단일화 필요.
|
||||
StackFrame currentStackFrame = getCurrentStackFrame();
|
||||
if (currentStackFrame instanceof RootStackFrame) {
|
||||
@@ -327,7 +327,7 @@ public final class Trace {
|
||||
}
|
||||
}
|
||||
|
||||
private void annotate(final AnnotationNames key) {
|
||||
private void annotate(final AnnotationKey key) {
|
||||
StackFrame currentStackFrame = getCurrentStackFrame();
|
||||
if (currentStackFrame instanceof RootStackFrame) {
|
||||
Span span = ((RootStackFrame) currentStackFrame).getSpan();
|
||||
|
||||
+4
-4
@@ -7,7 +7,7 @@ import java.nio.charset.Charset;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.profiler.common.AnnotationNames;
|
||||
import com.profiler.common.AnnotationKey;
|
||||
import com.profiler.logging.LoggingUtils;
|
||||
import net.spy.memcached.MemcachedNode;
|
||||
import net.spy.memcached.ops.OperationState;
|
||||
@@ -76,7 +76,7 @@ public class BaseOperationTransitionStateInterceptor implements StaticBeforeInte
|
||||
asyncTrace.recordRpcName(svcType, serviceCode, baseOperation.getClass().getSimpleName());
|
||||
|
||||
String cmd = getCommand(baseOperation);
|
||||
asyncTrace.recordAttibute(AnnotationNames.ARCUS_COMMAND, cmd);
|
||||
asyncTrace.recordAttibute(AnnotationKey.ARCUS_COMMAND, cmd);
|
||||
|
||||
// TimeObject timeObject = (TimeObject)
|
||||
// asyncTrace.getAttachObject();
|
||||
@@ -97,7 +97,7 @@ public class BaseOperationTransitionStateInterceptor implements StaticBeforeInte
|
||||
}
|
||||
Exception exception = baseOperation.getException();
|
||||
if (exception != null) {
|
||||
asyncTrace.recordAttibute(AnnotationNames.EXCEPTION, InterceptorUtils.exceptionToString(exception));
|
||||
asyncTrace.recordAttibute(AnnotationKey.EXCEPTION, InterceptorUtils.exceptionToString(exception));
|
||||
}
|
||||
if (!baseOperation.isCancelled()) {
|
||||
TimeObject timeObject = (TimeObject) asyncTrace.getAttachObject();
|
||||
@@ -105,7 +105,7 @@ public class BaseOperationTransitionStateInterceptor implements StaticBeforeInte
|
||||
asyncTrace.markAfterTime();
|
||||
asyncTrace.traceBlockEnd();
|
||||
} else {
|
||||
asyncTrace.recordAttribute(AnnotationNames.EXCEPTION, "cancelled by user");
|
||||
asyncTrace.recordAttribute(AnnotationKey.EXCEPTION, "cancelled by user");
|
||||
TimeObject timeObject = (TimeObject) asyncTrace.getAttachObject();
|
||||
// asyncTrace.record(Annotation.ClientRecv, timeObject.getCancelTime());
|
||||
asyncTrace.markAfterTime();
|
||||
|
||||
+3
-3
@@ -5,7 +5,7 @@ import java.util.UUID;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.profiler.common.AnnotationNames;
|
||||
import com.profiler.common.AnnotationKey;
|
||||
import com.profiler.common.ServiceType;
|
||||
import com.profiler.context.Header;
|
||||
import com.profiler.context.SpanID;
|
||||
@@ -68,9 +68,9 @@ public class ExecuteMethodInterceptor implements StaticAroundInterceptor, ByteCo
|
||||
trace.markBeforeTime();
|
||||
trace.recordRpcName(ServiceType.BLOC, traceContext.getApplicationId(), requestURL);
|
||||
trace.recordEndPoint(request.protocol().toString() + ":" + request.serverName().toString() + ":" + request.getServerPort());
|
||||
trace.recordAttribute(AnnotationNames.HTTP_URL, request.requestURI().toString());
|
||||
trace.recordAttribute(AnnotationKey.HTTP_URL, request.requestURI().toString());
|
||||
if (parameters != null && parameters.length() > 0) {
|
||||
trace.recordAttribute(AnnotationNames.HTTP_PARAM, parameters);
|
||||
trace.recordAttribute(AnnotationKey.HTTP_PARAM, parameters);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
|
||||
+2
-2
@@ -3,10 +3,10 @@ package com.profiler.modifier.connector.interceptors;
|
||||
import java.net.URI;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.profiler.common.AnnotationKey;
|
||||
import org.apache.http.HttpHost;
|
||||
import org.apache.http.client.methods.HttpUriRequest;
|
||||
|
||||
import com.profiler.common.AnnotationNames;
|
||||
import com.profiler.common.ServiceType;
|
||||
import com.profiler.context.Header;
|
||||
import com.profiler.context.Trace;
|
||||
@@ -65,7 +65,7 @@ public class Execute2MethodInterceptor implements StaticAroundInterceptor, ByteC
|
||||
|
||||
int port = host.getPort();
|
||||
trace.recordEndPoint(request.getProtocolVersion() + ":" + host.getHostName() + ((port > 0) ? ":" + port : ""));
|
||||
trace.recordAttribute(AnnotationNames.HTTP_URL, request.getRequestLine().getUri());
|
||||
trace.recordAttribute(AnnotationKey.HTTP_URL, request.getRequestLine().getUri());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+2
-2
@@ -2,10 +2,10 @@ package com.profiler.modifier.connector.interceptors;
|
||||
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.profiler.common.AnnotationKey;
|
||||
import org.apache.http.HttpHost;
|
||||
import org.apache.http.HttpRequest;
|
||||
|
||||
import com.profiler.common.AnnotationNames;
|
||||
import com.profiler.common.ServiceType;
|
||||
import com.profiler.context.Header;
|
||||
import com.profiler.context.Trace;
|
||||
@@ -66,7 +66,7 @@ public class ExecuteMethodInterceptor implements StaticAroundInterceptor, ByteCo
|
||||
|
||||
int port = host.getPort();
|
||||
trace.recordEndPoint(request.getProtocolVersion() + ":" + host.getHostName() + ((port > 0) ? ":" + port : ""));
|
||||
trace.recordAttribute(AnnotationNames.HTTP_URL, request.getRequestLine().getUri());
|
||||
trace.recordAttribute(AnnotationKey.HTTP_URL, request.getRequestLine().getUri());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+2
-3
@@ -7,7 +7,7 @@ import java.util.Map;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.profiler.common.AnnotationNames;
|
||||
import com.profiler.common.AnnotationKey;
|
||||
import com.profiler.common.util.ParsingResult;
|
||||
import com.profiler.context.Trace;
|
||||
import com.profiler.context.TraceContext;
|
||||
@@ -17,7 +17,6 @@ import com.profiler.interceptor.StaticAroundInterceptor;
|
||||
import com.profiler.logging.LoggingUtils;
|
||||
import com.profiler.modifier.db.util.DatabaseInfo;
|
||||
import com.profiler.util.MetaObject;
|
||||
import com.profiler.util.StringUtils;
|
||||
|
||||
public class PreparedStatementExecuteQueryInterceptor implements StaticAroundInterceptor, ByteCodeMethodDescriptorSupport {
|
||||
|
||||
@@ -59,7 +58,7 @@ public class PreparedStatementExecuteQueryInterceptor implements StaticAroundInt
|
||||
|
||||
Map bindValue = getBindValue.invoke(target);
|
||||
String bindString = toBindVariable(bindValue);
|
||||
trace.recordAttribute(AnnotationNames.SQL_BINDVALUE, bindString);
|
||||
trace.recordAttribute(AnnotationKey.SQL_BINDVALUE, bindString);
|
||||
|
||||
trace.recordApi(descriptor);
|
||||
// trace.recordApi(apiId);
|
||||
|
||||
@@ -7,7 +7,7 @@ import java.util.logging.Logger;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import com.profiler.common.AnnotationNames;
|
||||
import com.profiler.common.AnnotationKey;
|
||||
import com.profiler.common.ServiceType;
|
||||
import com.profiler.context.Header;
|
||||
import com.profiler.context.SpanID;
|
||||
@@ -92,7 +92,7 @@ public class DoXXXInterceptor implements StaticAroundInterceptor, ByteCodeMethod
|
||||
|
||||
int port = request.getServerPort();
|
||||
trace.recordEndPoint(request.getProtocol() + ":" + request.getServerName() + ((port > 0) ? ":" + port : ""));
|
||||
trace.recordAttribute(AnnotationNames.HTTP_URL, request.getRequestURI());
|
||||
trace.recordAttribute(AnnotationKey.HTTP_URL, request.getRequestURI());
|
||||
} catch (Exception e) {
|
||||
if (logger.isLoggable(Level.WARNING)) {
|
||||
logger.log(Level.WARNING, "Tomcat StandardHostValve trace start fail. Caused:" + e.getMessage(), e);
|
||||
@@ -116,7 +116,7 @@ public class DoXXXInterceptor implements StaticAroundInterceptor, ByteCodeMethod
|
||||
HttpServletRequest request = (HttpServletRequest) args[0];
|
||||
String parameters = getRequestParameter(request);
|
||||
if (parameters != null && parameters.length() > 0) {
|
||||
trace.recordAttribute(AnnotationNames.HTTP_PARAM, parameters);
|
||||
trace.recordAttribute(AnnotationKey.HTTP_PARAM, parameters);
|
||||
}
|
||||
|
||||
|
||||
|
||||
+3
-3
@@ -7,7 +7,7 @@ import java.util.logging.Logger;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import com.profiler.common.AnnotationNames;
|
||||
import com.profiler.common.AnnotationKey;
|
||||
import com.profiler.common.ServiceType;
|
||||
import com.profiler.context.Header;
|
||||
import com.profiler.context.SpanID;
|
||||
@@ -70,7 +70,7 @@ public class StandardHostValveInvokeInterceptor implements StaticAroundIntercept
|
||||
int port = request.getServerPort();
|
||||
trace.recordEndPoint(request.getProtocol() + ":" + request.getServerName() + ((port > 0) ? ":" + port : ""));
|
||||
trace.recordRemoteAddr(remoteAddr);
|
||||
trace.recordAttribute(AnnotationNames.HTTP_URL, request.getRequestURI());
|
||||
trace.recordAttribute(AnnotationKey.HTTP_URL, request.getRequestURI());
|
||||
} catch (Exception e) {
|
||||
if (logger.isLoggable(Level.WARNING)) {
|
||||
logger.log(Level.WARNING, "Tomcat StandardHostValve trace start fail. Caused:" + e.getMessage(), e);
|
||||
@@ -94,7 +94,7 @@ public class StandardHostValveInvokeInterceptor implements StaticAroundIntercept
|
||||
HttpServletRequest request = (HttpServletRequest) args[0];
|
||||
String parameters = getRequestParameter(request);
|
||||
if (parameters != null && parameters.length() > 0) {
|
||||
trace.recordAttribute(AnnotationNames.HTTP_PARAM, parameters);
|
||||
trace.recordAttribute(AnnotationKey.HTTP_PARAM, parameters);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user