[강운덕] [LUCYSUS-1744] serviceName의 span에 applicationId를 기본으로 포함하도록 수정함.

git-svn-id: http://svn.bds.nhncorp.com/pe/hippo-tomcat-profiler/trunk@1296 84d0f5b1-2673-498c-a247-62c4ff18d310
This commit is contained in:
Woonduk Kang
2013-03-06 07:51:31 +00:00
parent c6303b1f4d
commit e11936cb11
8 changed files with 14 additions and 32 deletions
@@ -104,10 +104,6 @@ public class AsyncTrace {
this.spanEvent.setServiceType(serviceType);
}
public void recordServiceName(final String serviceName) {
this.spanEvent.setServiceName(serviceName);
}
public void recordRpcName(final String rpcName) {
this.spanEvent.setRpc(rpcName);
@@ -24,7 +24,9 @@ public class SpanChunk implements Thriftable {
// TODO 반드시 1개 이상이라는 조건을 충족해야 된다.
SpanEvent first = spanEventList.get(0);
Span parentSpan = first.getParentSpan();
tSpanChunk.setAgentId(Agent.getInstance().getAgentId());
tSpanChunk.setApplicationId(Agent.getInstance().getApplicationName());
tSpanChunk.setAgentIdentifier(Agent.getInstance().getIdentifier());
UUID id = parentSpan.getTraceID().getId();
@@ -44,8 +46,9 @@ public class SpanChunk implements Thriftable {
for (SpanEvent spanEvent : spanEventList) {
com.profiler.common.dto.thrift.SpanEvent tSpanEvent = new com.profiler.common.dto.thrift.SpanEvent();
tSpanEvent.setAgentId(Agent.getInstance().getAgentId());
tSpanEvent.setAgentIdentifier(Agent.getInstance().getIdentifier());
// tSpanEvent.setAgentId(Agent.getInstance().getAgentId());
// tSpanEvent.setApplicationId(Agent.getInstance().getApplicationName());
// tSpanEvent.setAgentIdentifier(Agent.getInstance().getIdentifier());
long parentSpanStartTime = spanEvent.getParentSpan().getStartTime();
tSpanEvent.setStartElapsed((int) (spanEvent.getStartTime() - parentSpanStartTime));
@@ -54,12 +57,10 @@ public class SpanChunk implements Thriftable {
tSpanEvent.setSequence(spanEvent.getSequence());
tSpanEvent.setRpc(spanEvent.getRpc());
// tSpanEvent.setServiceName(spanEvent.getServiceName());
tSpanEvent.setServiceType(spanEvent.getServiceType().getCode());
tSpanEvent.setDestinationId(spanEvent.getDestionationId());
tSpanEvent.setEndPoint(spanEvent.getEndPoint());
tSpanEvent.setDestinationId(spanEvent.getDestionationId());
// 여기서 데이터 인코딩을 하자.
List<com.profiler.common.dto.thrift.Annotation> annotationList = new ArrayList<com.profiler.common.dto.thrift.Annotation>(spanEvent.getAnnotationSize());
@@ -80,4 +81,6 @@ public class SpanChunk implements Thriftable {
}
return result;
}
}
@@ -19,7 +19,6 @@ public class SpanEvent implements Thriftable {
private long startTime;
private long endTime;
private String serviceName;
private String rpc;
private ServiceType serviceType;
@@ -65,13 +64,6 @@ public class SpanEvent implements Thriftable {
return this.endPoint;
}
public String getServiceName() {
return serviceName;
}
public void setServiceName(String serviceName) {
this.serviceName = serviceName;
}
public String getRpc() {
return rpc;
@@ -154,7 +146,6 @@ public class SpanEvent implements Thriftable {
sb.append(",\n\t StartTime=").append(startTime);
sb.append(", EndTime=").append(endTime);
sb.append(",\n\t Name=").append(rpc);
sb.append(", ServiceName=").append(serviceName);
sb.append(", ServiceType=").append(serviceType);
sb.append(", EndPoint=").append(endPoint);
sb.append(", Seq=").append(sequence);
@@ -181,9 +172,10 @@ public class SpanEvent implements Thriftable {
spanEvent.setEndElapsed((int) (endTime - startTime));
spanEvent.setSequence(sequence);
// 다른 span의 sub로 들어가지 않을 경우
// Span내부의 SpanEvent로 들어가지 않을 경우
if (!child) {
spanEvent.setAgentId(Agent.getInstance().getAgentId());
spanEvent.setAgentId(Agent.getInstance().getApplicationName());
spanEvent.setAgentIdentifier(Agent.getInstance().getIdentifier());
TraceID parentSpanTraceID = parentSpan.getTraceID();
@@ -193,19 +185,15 @@ public class SpanEvent implements Thriftable {
}
spanEvent.setRpc(rpc);
spanEvent.setServiceName(serviceName);
if (serviceType != null) {
spanEvent.setServiceType(serviceType.getCode());
}
spanEvent.setServiceType(serviceType.getCode());
spanEvent.setEndPoint(endPoint);
spanEvent.setDestinationId(this.destionationId);
// 여기서 데이터 인코딩을 하자.
List<com.profiler.common.dto.thrift.Annotation> annotationList = new ArrayList<com.profiler.common.dto.thrift.Annotation>(annotations.size());
for (Annotation a : annotations) {
annotationList.add(a.toThrift());
for (Annotation annotation : annotations) {
annotationList.add(annotation.toThrift());
}
spanEvent.setAnnotations(annotationList);
@@ -74,7 +74,6 @@ public class BaseOperationTransitionStateInterceptor implements StaticBeforeInte
}
asyncTrace.recordServiceType(svcType);
asyncTrace.recordServiceName(serviceCode);
asyncTrace.recordRpcName(baseOperation.getClass().getSimpleName());
asyncTrace.recordDestinationId(serviceCode);
@@ -68,8 +68,6 @@ public class ExecuteMethodInterceptor implements StaticAroundInterceptor, ByteCo
trace.markBeforeTime();
trace.recordServiceType(ServiceType.BLOC);
// EXECUTEMETHOD interceptor는 span만 적용된 가능성이 있어서 같아서 유지함. Span의 ApplicationName으로 들어가도록 추가 수정해야 됨.
// trace.recordServiceName(traceContext.getApplicationId());
trace.recordRpcName(requestURL);
@@ -62,7 +62,6 @@ public class Execute2MethodInterceptor implements StaticAroundInterceptor, ByteC
HttpHost host = extractHost(request.getURI());
trace.recordServiceType(ServiceType.HTTP_CLIENT);
// trace.recordServiceName(request.getProtocolVersion().toString());
trace.recordRpcName("CLIENT");
int port = host.getPort();
@@ -63,7 +63,6 @@ public class ExecuteMethodInterceptor implements StaticAroundInterceptor, ByteCo
request.addHeader(Header.HTTP_FLAGS.toString(), String.valueOf(nextId.getFlags()));
trace.recordServiceType(ServiceType.HTTP_CLIENT);
// trace.recordServiceName(request.getProtocolVersion().toString());
trace.recordRpcName("CLIENT");
int port = host.getPort();