mirror of
https://github.com/wahyd4/pinpoint.git
synced 2026-08-17 00:36:02 +10:00
[강운덕] [WEB-45] filter를 쳤을 경우도 node의 응답속도를 hbase가 아닌 메모리의 span에서 가져오도록 수정함.
git-svn-id: http://svn.bds.nhncorp.com/pe/hippo-web/trunk@3320 84d0f5b1-2673-498c-a247-62c4ff18d310
This commit is contained in:
@@ -82,14 +82,40 @@ public class ApplicationMap {
|
||||
return applicationNames.contains(applicationName);
|
||||
}
|
||||
|
||||
public void appendResponseTime(Range range, MapResponseDao mapResponseDao) {
|
||||
List<Node> nodes = this.nodeList.getNodeList();
|
||||
public static interface ResponseDataSource {
|
||||
ResponseHistogramSummary getResponseHistogramSummary(Application application);
|
||||
}
|
||||
|
||||
public void appendResponseTime(final Range range, final MapResponseDao mapResponseDao) {
|
||||
appendResponseTime(new ResponseDataSource() {
|
||||
@Override
|
||||
public ResponseHistogramSummary getResponseHistogramSummary(Application application) {
|
||||
final List<RawResponseTime> responseHistogram = mapResponseDao.selectResponseTime(application, range);
|
||||
return createHistogramSummary(application, responseHistogram);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void appendResponseTime(final Map<Application, ResponseHistogramSummary> histogramSummaryMap) {
|
||||
appendResponseTime(new ResponseDataSource() {
|
||||
@Override
|
||||
public ResponseHistogramSummary getResponseHistogramSummary(Application application) {
|
||||
return histogramSummaryMap.get(application);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void appendResponseTime(ResponseDataSource responseDataSource) {
|
||||
if (responseDataSource == null) {
|
||||
throw new NullPointerException("responseDataSource must not be null");
|
||||
}
|
||||
|
||||
final List<Node> nodes = this.nodeList.getNodeList();
|
||||
for (Node node : nodes) {
|
||||
if (node.getServiceType().isWas()) {
|
||||
// was일 경우 자신의 response 히스토그램을 조회하여 채운다.
|
||||
final Application application = new Application(node.getApplicationName(), node.getServiceType());
|
||||
final List<RawResponseTime> responseHistogram = mapResponseDao.selectResponseTime(application, range);
|
||||
ResponseHistogramSummary histogramSummary = createHistogramSummary(application, responseHistogram);
|
||||
ResponseHistogramSummary histogramSummary = responseDataSource.getResponseHistogramSummary(application);
|
||||
node.setResponseHistogramSummary(histogramSummary);
|
||||
} else if(node.getServiceType().isTerminal() || node.getServiceType().isUnknown()) {
|
||||
// 터미널 노드인경우, 자신을 가리키는 link값을 합하여 histogram을 생성한다.
|
||||
|
||||
@@ -40,6 +40,12 @@ public class ResponseHistogram implements JsonSerializable {
|
||||
this.histogramSchema = serviceType.getHistogramSchema();
|
||||
}
|
||||
|
||||
public void addElapsedTime(int elapsedTime) {
|
||||
HistogramSlot histogramSlot = histogramSchema.findHistogramSlot(elapsedTime);
|
||||
short slotTime = histogramSlot.getSlotTime();
|
||||
addSample(slotTime, 1);
|
||||
}
|
||||
|
||||
public ResponseHistogram(final short serviceType) {
|
||||
this(ServiceType.findServiceType(serviceType));
|
||||
}
|
||||
@@ -56,6 +62,7 @@ public class ResponseHistogram implements JsonSerializable {
|
||||
this.errorCount += count;
|
||||
return;
|
||||
}
|
||||
// TODO slotTime 은 <= 아니고 ==으로 수정되어야함.
|
||||
if (slotTime <= histogramSchema.getFastSlot().getSlotTime()) {
|
||||
this.fastCount += count;
|
||||
return;
|
||||
|
||||
@@ -13,6 +13,7 @@ import com.nhn.pinpoint.common.HistogramSchema;
|
||||
import com.nhn.pinpoint.common.HistogramSlot;
|
||||
import com.nhn.pinpoint.web.applicationmap.ApplicationMapBuilder;
|
||||
import com.nhn.pinpoint.web.applicationmap.rawdata.LinkStatistics;
|
||||
import com.nhn.pinpoint.web.applicationmap.rawdata.ResponseHistogram;
|
||||
import com.nhn.pinpoint.web.dao.*;
|
||||
import com.nhn.pinpoint.web.vo.*;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
@@ -193,6 +194,7 @@ public class FilteredApplicationMapServiceImpl implements FilteredApplicationMap
|
||||
final Map<NodeId, LinkStatistics> linkStatMap = new HashMap<NodeId, LinkStatistics>();
|
||||
|
||||
final TimeSeriesStore timeSeriesStore = new TimeSeriesStoreImpl2(range);
|
||||
final Map<Application, ResponseHistogramSummary> responseHistogramSummaryMap = new HashMap<Application, ResponseHistogramSummary>();
|
||||
/**
|
||||
* 통계정보로 변환한다.
|
||||
*/
|
||||
@@ -206,6 +208,9 @@ public class FilteredApplicationMapServiceImpl implements FilteredApplicationMap
|
||||
}
|
||||
|
||||
for (SpanBo span : transaction) {
|
||||
// SPAN의 respoinseTime의 통계를 저장한다.
|
||||
recordSpanResponseTime(span, responseHistogramSummaryMap);
|
||||
|
||||
final Node srcNode = createNode(span, transactionSpanMap);
|
||||
final Node destNode = new Node(span.getApplicationId(), span.getServiceType());
|
||||
// record해야 되거나. rpc콜은 링크이다.
|
||||
@@ -244,12 +249,31 @@ public class FilteredApplicationMapServiceImpl implements FilteredApplicationMap
|
||||
List<LinkStatistics> linkStatisticsList = new ArrayList<LinkStatistics>(linkStatMap.values());
|
||||
ApplicationMap map = new ApplicationMapBuilder().build(linkStatisticsList);
|
||||
map.setTimeSeriesStore(timeSeriesStore);
|
||||
map.appendResponseTime(range, this.mapResponseDao);
|
||||
map.appendResponseTime(responseHistogramSummaryMap);
|
||||
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
private void recordSpanResponseTime(SpanBo span, Map<Application, ResponseHistogramSummary> responseHistogramSummaryMap) {
|
||||
ServiceType serviceType = span.getServiceType();
|
||||
String applicationId = span.getApplicationId();
|
||||
Application spanKey = new Application(applicationId, serviceType);
|
||||
ResponseHistogramSummary responseHistogramSummary = responseHistogramSummaryMap.get(spanKey);
|
||||
if (responseHistogramSummary == null) {
|
||||
responseHistogramSummary = new ResponseHistogramSummary(spanKey);
|
||||
responseHistogramSummaryMap.put(spanKey, responseHistogramSummary);
|
||||
}
|
||||
|
||||
ResponseHistogram histogram = new ResponseHistogram(serviceType);
|
||||
if (span.getErrCode() != 0) {
|
||||
histogram.addElapsedTime(HistogramSchema.ERROR_SLOT_TIME);
|
||||
} else {
|
||||
histogram.addElapsedTime(span.getElapsed());
|
||||
}
|
||||
responseHistogramSummary.addTotal(histogram);
|
||||
}
|
||||
|
||||
|
||||
private void addNodeFromSpanEvent(SpanBo span, Map<NodeId, LinkStatistics> statisticsMap, TimeSeriesStore timeSeriesStore, Map<Long, SpanBo> transactionSpanMap) {
|
||||
/**
|
||||
|
||||
@@ -9,7 +9,7 @@ public class ResponseHistogramSummary {
|
||||
|
||||
private final Application application;
|
||||
|
||||
private final com.nhn.pinpoint.web.applicationmap.rawdata.ResponseHistogram total;
|
||||
private final ResponseHistogram total;
|
||||
|
||||
public ResponseHistogramSummary(Application application) {
|
||||
if (application == null) {
|
||||
|
||||
Reference in New Issue
Block a user