mirror of
https://github.com/wahyd4/pinpoint.git
synced 2026-08-15 15:55:54 +10:00
[강운덕] [LUCYSUS-1744] common에 있는 SpanEvent를 SpanEventBo로 변경. ServiceType에 includeDestinationId옵션을 포함시켜 ApiType에 출력여부를 옵션화 시킴
git-svn-id: http://svn.bds.nhncorp.com/pe/hippo-web/trunk@1305 84d0f5b1-2673-498c-a247-62c4ff18d310
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
package com.nhn.hippo.web.calltree.server;
|
||||
|
||||
import com.profiler.common.bo.SpanBo;
|
||||
import com.profiler.common.bo.SpanEvent;
|
||||
import com.profiler.common.bo.SpanEventBo;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -14,8 +14,8 @@ public class AgentIdNodeSelector implements NodeSelector {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getServerId(SpanEvent spanEvent) {
|
||||
return spanEvent.getEndPoint();
|
||||
public String getServerId(SpanEventBo spanEventBo) {
|
||||
return spanEventBo.getEndPoint();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.nhn.hippo.web.calltree.server;
|
||||
|
||||
import com.profiler.common.bo.SpanBo;
|
||||
import com.profiler.common.bo.SpanEvent;
|
||||
import com.profiler.common.bo.SpanEventBo;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -13,7 +13,7 @@ public class ApplicationIdNodeSelector implements NodeSelector {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getServerId(SpanEvent spanEvent) {
|
||||
return spanEvent.getDestinationId();
|
||||
public String getServerId(SpanEventBo spanEventBo) {
|
||||
return spanEventBo.getDestinationId();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.nhn.hippo.web.calltree.server;
|
||||
|
||||
import com.profiler.common.bo.SpanBo;
|
||||
import com.profiler.common.bo.SpanEvent;
|
||||
import com.profiler.common.bo.SpanEventBo;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -10,6 +10,6 @@ public interface NodeSelector {
|
||||
|
||||
String getServerId(SpanBo span);
|
||||
|
||||
String getServerId(SpanEvent spanEvent);
|
||||
String getServerId(SpanEventBo spanEventBo);
|
||||
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ import java.util.Set;
|
||||
|
||||
import com.profiler.common.ServiceType;
|
||||
import com.profiler.common.bo.SpanBo;
|
||||
import com.profiler.common.bo.SpanEvent;
|
||||
import com.profiler.common.bo.SpanEventBo;
|
||||
|
||||
/**
|
||||
* @author netspider
|
||||
@@ -20,25 +20,24 @@ public class Server implements Comparable<Server> {
|
||||
|
||||
protected int recursiveCallCount;
|
||||
|
||||
public Server(SpanEvent spanEvent, NodeSelector nodeSelector) {
|
||||
if (spanEvent.getServiceType().isTerminal()) {
|
||||
this.hosts.add(spanEvent.getAgentId());
|
||||
public Server(SpanEventBo spanEventBo, NodeSelector nodeSelector) {
|
||||
if (spanEventBo.getServiceType().isTerminal()) {
|
||||
this.hosts.add(spanEventBo.getAgentId());
|
||||
} else {
|
||||
this.hosts.add(spanEvent.getEndPoint());
|
||||
this.hosts.add(spanEventBo.getEndPoint());
|
||||
}
|
||||
|
||||
if (spanEvent.getServiceType().isRpcClient()) {
|
||||
if (spanEventBo.getServiceType().isRpcClient()) {
|
||||
// this is unknown cloud, there is not exists the child spanEvent.
|
||||
this.id = spanEvent.getEndPoint();
|
||||
this.applicationName = spanEvent.getEndPoint();
|
||||
this.id = spanEventBo.getEndPoint();
|
||||
this.applicationName = spanEventBo.getEndPoint();
|
||||
this.serviceType = ServiceType.UNKNOWN_CLOUD;
|
||||
} else {
|
||||
this.id = nodeSelector.getServerId(spanEvent);
|
||||
this.applicationName = spanEvent.getDestinationId();
|
||||
this.serviceType = spanEvent.getServiceType();
|
||||
this.id = nodeSelector.getServerId(spanEventBo);
|
||||
this.applicationName = spanEventBo.getDestinationId();
|
||||
this.serviceType = spanEventBo.getServiceType();
|
||||
}
|
||||
|
||||
// this.endPoint = spanEvent.getEndPoint();
|
||||
this.recursiveCallCount = 0;
|
||||
}
|
||||
|
||||
@@ -53,7 +52,7 @@ public class Server implements Comparable<Server> {
|
||||
}
|
||||
|
||||
this.applicationName = span.getApplicationId();
|
||||
// this.endPoint = span.getEndPoint();
|
||||
|
||||
this.recursiveCallCount = span.getRecursiveCallCount();
|
||||
this.serviceType = span.getServiceType();
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import com.profiler.common.bo.SpanEventBo;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@@ -14,7 +15,6 @@ import com.nhn.hippo.web.vo.ResponseHistogram;
|
||||
import com.nhn.hippo.web.vo.TerminalStatistics;
|
||||
import com.profiler.common.ServiceType;
|
||||
import com.profiler.common.bo.SpanBo;
|
||||
import com.profiler.common.bo.SpanEvent;
|
||||
|
||||
/**
|
||||
* Call Tree
|
||||
@@ -34,7 +34,7 @@ public class ServerCallTree {
|
||||
|
||||
// temporary variables
|
||||
private final List<SpanBo> spans = new ArrayList<SpanBo>();
|
||||
private final List<SpanEvent> subspans = new ArrayList<SpanEvent>();
|
||||
private final List<SpanEventBo> subspans = new ArrayList<SpanEventBo>();
|
||||
private final Map<String, String> spanIdToServerId = new HashMap<String, String>();
|
||||
private final Map<String, String> spanIdToClientId = new HashMap<String, String>();
|
||||
private final Map<String, TerminalStatistics> terminalRequests = new HashMap<String, TerminalStatistics>();
|
||||
@@ -70,22 +70,22 @@ public class ServerCallTree {
|
||||
spanIdToClientId.put(spanId, server.getId());
|
||||
}
|
||||
|
||||
public void addSpanEventList(List<SpanEvent> spanEventBoList) {
|
||||
for (SpanEvent spanEventBo : spanEventBoList) {
|
||||
public void addSpanEventList(List<SpanEventBo> spanEventBoList) {
|
||||
for (SpanEventBo spanEventBo : spanEventBoList) {
|
||||
this.addSubSpan(spanEventBo);
|
||||
}
|
||||
}
|
||||
|
||||
public void addSubSpan(SpanEvent spanEvent) {
|
||||
Server server = new Server(spanEvent, nodeSelector);
|
||||
public void addSubSpan(SpanEventBo spanEventBo) {
|
||||
Server server = new Server(spanEventBo, nodeSelector);
|
||||
|
||||
if (server.getId() == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
addServer(spanEvent.getDestinationId(), server);
|
||||
addServer(spanEventBo.getDestinationId(), server);
|
||||
|
||||
subspans.add(spanEvent);
|
||||
subspans.add(spanEventBo);
|
||||
}
|
||||
|
||||
public void addSpanList(List<SpanBo> spanList) {
|
||||
@@ -177,8 +177,8 @@ public class ServerCallTree {
|
||||
}
|
||||
|
||||
// add terminal nodes
|
||||
for (SpanEvent span : subspans) {
|
||||
String from = String.valueOf(span.getSpanId());
|
||||
for (SpanEventBo spanEventBo : subspans) {
|
||||
String from = String.valueOf(spanEventBo.getSpanId());
|
||||
String to;
|
||||
|
||||
// if (span.getServiceType().isRpcClient()) {
|
||||
@@ -187,17 +187,17 @@ public class ServerCallTree {
|
||||
// } else {
|
||||
// to = String.valueOf(span.getServiceName());
|
||||
// }
|
||||
to = span.getDestinationId();
|
||||
to = spanEventBo.getDestinationId();
|
||||
|
||||
Server fromServer = servers.get(spanIdToServerId.get(from));
|
||||
Server toServer = servers.get(spanIdToServerId.get(to));
|
||||
|
||||
ResponseHistogram histogram = new ResponseHistogram(span.getServiceType());
|
||||
histogram.addSample(span.getEndElapsed());
|
||||
ResponseHistogram histogram = new ResponseHistogram(spanEventBo.getServiceType());
|
||||
histogram.addSample(spanEventBo.getEndElapsed());
|
||||
ServerRequest serverRequest = new ServerRequest(fromServer, toServer, histogram);
|
||||
|
||||
if (serverRequests.containsKey(serverRequest.getId())) {
|
||||
serverRequests.get(serverRequest.getId()).getHistogram().addSample(span.getEndElapsed());
|
||||
serverRequests.get(serverRequest.getId()).getHistogram().addSample(spanEventBo.getEndElapsed());
|
||||
} else {
|
||||
serverRequests.put(serverRequest.getId(), serverRequest);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.nhn.hippo.web.calltree.span;
|
||||
|
||||
import com.profiler.common.bo.SpanBo;
|
||||
import com.profiler.common.bo.SpanEvent;
|
||||
import com.profiler.common.bo.SpanEventBo;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -9,7 +9,7 @@ import com.profiler.common.bo.SpanEvent;
|
||||
public class SpanAlign {
|
||||
private int depth;
|
||||
private SpanBo spanBo;
|
||||
private SpanEvent spanEventBo;
|
||||
private SpanEventBo spanEventBo;
|
||||
private boolean span = true;
|
||||
|
||||
public SpanAlign(int depth, SpanBo spanBo) {
|
||||
@@ -18,7 +18,7 @@ public class SpanAlign {
|
||||
this.span = true;
|
||||
}
|
||||
|
||||
public SpanAlign(int depth, SpanBo spanBo, SpanEvent spanEventBo) {
|
||||
public SpanAlign(int depth, SpanBo spanBo, SpanEventBo spanEventBo) {
|
||||
this.depth = depth;
|
||||
this.spanBo = spanBo;
|
||||
this.spanEventBo = spanEventBo;
|
||||
@@ -41,7 +41,7 @@ public class SpanAlign {
|
||||
return spanBo;
|
||||
}
|
||||
|
||||
public SpanEvent getSpanEventBo() {
|
||||
public SpanEventBo getSpanEventBo() {
|
||||
return spanEventBo;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ package com.nhn.hippo.web.calltree.span;
|
||||
import java.util.*;
|
||||
|
||||
import com.profiler.common.bo.SpanBo;
|
||||
import com.profiler.common.bo.SpanEvent;
|
||||
import com.profiler.common.bo.SpanEventBo;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -56,11 +56,11 @@ public class SpanAligner2 {
|
||||
SpanAlign element = new SpanAlign(depth, parentSpan);
|
||||
container.add(element);
|
||||
|
||||
List<SpanEvent> spanEventBoList = parentSpan.getSpanEventBoList();
|
||||
List<SpanEventBo> spanEventBoList = parentSpan.getSpanEventBoList();
|
||||
if (spanEventBoList == null) {
|
||||
return;
|
||||
}
|
||||
for (SpanEvent spanEventBo : spanEventBoList) {
|
||||
for (SpanEventBo spanEventBo : spanEventBoList) {
|
||||
if (spanEventBo.getDepth() != -1) {
|
||||
depth = spanDepth + spanEventBo.getDepth() + 1;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.nhn.hippo.web.calltree.span;
|
||||
|
||||
import com.profiler.common.bo.SpanBo;
|
||||
import com.profiler.common.bo.SpanEvent;
|
||||
import com.profiler.common.bo.SpanEventBo;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
@@ -38,8 +38,8 @@ public class SpanPopulator {
|
||||
SpanBo span = spanAlign.getSpanBo();
|
||||
populatedList.add(spanAlign);
|
||||
long startTime = span.getStartTime();
|
||||
List<SpanEvent> spanEventBoList = sortSpanEvent(span);
|
||||
for (SpanEvent spanEventBo : spanEventBoList) {
|
||||
List<SpanEventBo> spanEventBoList = sortSpanEvent(span);
|
||||
for (SpanEventBo spanEventBo : spanEventBoList) {
|
||||
long subStartTime = startTime + spanEventBo.getStartElapsed();
|
||||
long nextSpanStartTime = getNextSpanStartTime();
|
||||
if (subStartTime <= nextSpanStartTime) {
|
||||
@@ -65,14 +65,14 @@ public class SpanPopulator {
|
||||
return list.get(nextIndex).getSpanBo().getStartTime();
|
||||
}
|
||||
|
||||
private List<SpanEvent> sortSpanEvent(SpanBo span) {
|
||||
List<SpanEvent> spanEventBoList = span.getSpanEventBoList();
|
||||
private List<SpanEventBo> sortSpanEvent(SpanBo span) {
|
||||
List<SpanEventBo> spanEventBoList = span.getSpanEventBoList();
|
||||
if (spanEventBoList == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
Collections.sort(spanEventBoList, new Comparator<SpanEvent>() {
|
||||
Collections.sort(spanEventBoList, new Comparator<SpanEventBo>() {
|
||||
@Override
|
||||
public int compare(SpanEvent o1, SpanEvent o2) {
|
||||
public int compare(SpanEventBo o1, SpanEventBo o2) {
|
||||
long o1Timestamp = o1.getSequence();
|
||||
long o2Timestamp = o2.getSequence();
|
||||
if (o1Timestamp > o2Timestamp) {
|
||||
|
||||
@@ -2,7 +2,7 @@ package com.nhn.hippo.web.mapper;
|
||||
|
||||
import com.profiler.common.bo.AnnotationBo;
|
||||
import com.profiler.common.bo.SpanBo;
|
||||
import com.profiler.common.bo.SpanEvent;
|
||||
import com.profiler.common.bo.SpanEventBo;
|
||||
import com.profiler.common.hbase.HBaseTables;
|
||||
import com.profiler.common.util.BytesUtils;
|
||||
import org.apache.hadoop.hbase.KeyValue;
|
||||
@@ -47,7 +47,7 @@ public class SpanMapper implements RowMapper<List<SpanBo>> {
|
||||
KeyValue[] keyList = result.raw();
|
||||
List<SpanBo> spanList = new ArrayList<SpanBo>();
|
||||
Map<Integer, SpanBo> spanMap = new HashMap<Integer, SpanBo>();
|
||||
List<SpanEvent> spanEventBoList = new ArrayList<SpanEvent>();
|
||||
List<SpanEventBo> spanEventBoList = new ArrayList<SpanEventBo>();
|
||||
for (KeyValue kv : keyList) {
|
||||
// family name "span"일때로만 한정.
|
||||
if (kv.getFamilyLength() == HBaseTables.TRACES_CF_SPAN.length) {
|
||||
@@ -64,7 +64,7 @@ public class SpanMapper implements RowMapper<List<SpanBo>> {
|
||||
spanList.add(spanBo);
|
||||
spanMap.put(spanBo.getSpanId(), spanBo);
|
||||
} else if (kv.getFamilyLength() == HBaseTables.TRACES_CF_TERMINALSPAN.length) {
|
||||
SpanEvent spanEventBo = new SpanEvent();
|
||||
SpanEventBo spanEventBo = new SpanEventBo();
|
||||
spanEventBo.setMostTraceId(most);
|
||||
spanEventBo.setLeastTraceId(least);
|
||||
|
||||
@@ -82,7 +82,7 @@ public class SpanMapper implements RowMapper<List<SpanBo>> {
|
||||
spanEventBoList.add(spanEventBo);
|
||||
}
|
||||
}
|
||||
for (SpanEvent spanEventBo : spanEventBoList) {
|
||||
for (SpanEventBo spanEventBo : spanEventBoList) {
|
||||
SpanBo spanBo = spanMap.get(spanEventBo.getSpanId());
|
||||
if (spanBo != null) {
|
||||
spanBo.addSpanEvent(spanEventBo);
|
||||
|
||||
@@ -10,7 +10,7 @@ import java.util.Set;
|
||||
|
||||
import com.nhn.hippo.web.calltree.server.AgentIdNodeSelector;
|
||||
import com.nhn.hippo.web.calltree.server.ApplicationIdNodeSelector;
|
||||
import com.profiler.common.bo.SpanEvent;
|
||||
import com.profiler.common.bo.SpanEventBo;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -130,22 +130,22 @@ public class FlowChartServiceImpl implements FlowChartService {
|
||||
ServerCallTree tree = createServerCallTree(transaction);
|
||||
|
||||
// subSpan에서 record할 데이터만 골라낸다.
|
||||
List<SpanEvent> spanEventBoList = findRecordStatisticsSpanEventData(transaction, endPoints);
|
||||
List<SpanEventBo> spanEventBoList = findRecordStatisticsSpanEventData(transaction, endPoints);
|
||||
tree.addSpanEventList(spanEventBoList);
|
||||
|
||||
return tree.build();
|
||||
}
|
||||
|
||||
private List<SpanEvent> findRecordStatisticsSpanEventData(List<SpanBo> transaction, Set<String> endPoints) {
|
||||
List<SpanEvent> filterSpanEvent = new ArrayList<SpanEvent>();
|
||||
private List<SpanEventBo> findRecordStatisticsSpanEventData(List<SpanBo> transaction, Set<String> endPoints) {
|
||||
List<SpanEventBo> filterSpanEventBo = new ArrayList<SpanEventBo>();
|
||||
for (SpanBo eachTransaction : transaction) {
|
||||
List<SpanEvent> spanEventBoList = eachTransaction.getSpanEventBoList();
|
||||
List<SpanEventBo> spanEventBoList = eachTransaction.getSpanEventBoList();
|
||||
|
||||
if (spanEventBoList == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
for (SpanEvent spanEventBo : spanEventBoList) {
|
||||
for (SpanEventBo spanEventBo : spanEventBoList) {
|
||||
// 통계정보로 잡지 않을 데이터는 스킵한다.
|
||||
if (!spanEventBo.getServiceType().isRecordStatistics()) {
|
||||
continue;
|
||||
@@ -154,11 +154,11 @@ public class FlowChartServiceImpl implements FlowChartService {
|
||||
// remove subspan of the rpc client
|
||||
if (!endPoints.contains(spanEventBo.getEndPoint())) {
|
||||
// this is unknown cloud
|
||||
filterSpanEvent.add(spanEventBo);
|
||||
filterSpanEventBo.add(spanEventBo);
|
||||
}
|
||||
}
|
||||
}
|
||||
return filterSpanEvent;
|
||||
return filterSpanEventBo;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -77,10 +77,14 @@ public class Record {
|
||||
// parameter일 경우 serviceType이 없음.
|
||||
return "";
|
||||
}
|
||||
|
||||
return serviceType.getDesc();
|
||||
}
|
||||
return serviceType.getDesc() + "(" + destinationId + ")";
|
||||
if (serviceType.isIncludeDestinationId()) {
|
||||
return serviceType.getDesc() + "(" + destinationId + ")";
|
||||
} else {
|
||||
return serviceType.getDesc();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public boolean isExcludeFromTimeline() {
|
||||
|
||||
@@ -8,7 +8,7 @@ import com.nhn.hippo.web.calltree.span.SpanAlign;
|
||||
import com.profiler.common.AnnotationKey;
|
||||
import com.profiler.common.bo.AnnotationBo;
|
||||
import com.profiler.common.bo.SpanBo;
|
||||
import com.profiler.common.bo.SpanEvent;
|
||||
import com.profiler.common.bo.SpanEventBo;
|
||||
import com.profiler.common.util.AnnotationUtils;
|
||||
|
||||
/**
|
||||
@@ -105,24 +105,24 @@ public class RecordSet {
|
||||
recordset.add(record);
|
||||
addAnnotationRecord(spanAlign.getDepth() + 1, spanBo.getAnnotationBoList());
|
||||
} else {
|
||||
SpanEvent spanEvent = spanAlign.getSpanEventBo();
|
||||
SpanEventBo spanEventBo = spanAlign.getSpanEventBo();
|
||||
|
||||
AnnotationUtils.sortAnnotationListByKey(spanEvent);
|
||||
String method = (String) AnnotationUtils.getDisplayMethod(spanEvent);
|
||||
Object arguments = AnnotationUtils.getDisplayArgument(spanEvent);
|
||||
AnnotationUtils.sortAnnotationListByKey(spanEventBo);
|
||||
String method = (String) AnnotationUtils.getDisplayMethod(spanEventBo);
|
||||
Object arguments = AnnotationUtils.getDisplayArgument(spanEventBo);
|
||||
|
||||
long begin = spanAlign.getSpanBo().getStartTime() + spanEvent.getStartElapsed();
|
||||
long elapsed = spanEvent.getEndElapsed();
|
||||
long begin = spanAlign.getSpanBo().getStartTime() + spanEventBo.getStartElapsed();
|
||||
long elapsed = spanEventBo.getEndElapsed();
|
||||
|
||||
if (!marked) {
|
||||
setStartTime(begin);
|
||||
setEndTime(begin + elapsed);
|
||||
marked = true;
|
||||
}
|
||||
String destinationId = spanEvent.getDestinationId();
|
||||
String destinationId = spanEventBo.getDestinationId();
|
||||
// recordset.add(new Record(spanAlign.getDepth(), true, method, (arguments != null) ? arguments.toString() : "", begin, elapsed, spanEvent.getAgentId(), spanEvent.getServiceName(), spanEvent.getServiceType(), destinationId));
|
||||
recordset.add(new Record(spanAlign.getDepth(), true, method, (arguments != null) ? arguments.toString() : "", begin, elapsed, spanEvent.getAgentId(), spanEvent.getDestinationId(), spanEvent.getServiceType(), destinationId));
|
||||
addAnnotationRecord(spanAlign.getDepth() + 1, spanEvent.getAnnotationBoList());
|
||||
recordset.add(new Record(spanAlign.getDepth(), true, method, (arguments != null) ? arguments.toString() : "", begin, elapsed, spanEventBo.getAgentId(), spanEventBo.getDestinationId(), spanEventBo.getServiceType(), destinationId));
|
||||
addAnnotationRecord(spanAlign.getDepth() + 1, spanEventBo.getAnnotationBoList());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user