mirror of
https://github.com/wahyd4/pinpoint.git
synced 2026-08-17 00:36:02 +10:00
[강운덕] [WEB-48] 전체Map의 응답속도 데이터를 가지고 있는 클래스로 리팩토링함.
git-svn-id: http://svn.bds.nhncorp.com/pe/hippo-web/trunk@3331 84d0f5b1-2673-498c-a247-62c4ff18d310
This commit is contained in:
@@ -97,11 +97,11 @@ public class ApplicationMap {
|
||||
});
|
||||
}
|
||||
|
||||
public void appendResponseTime(final Map<Application, ResponseHistogramSummary> histogramSummaryMap) {
|
||||
public void appendResponseTime(final MapResponseHistogramSummary mapHistogramSummary) {
|
||||
appendResponseTime(new ResponseDataSource() {
|
||||
@Override
|
||||
public ResponseHistogramSummary getResponseHistogramSummary(Application application) {
|
||||
return histogramSummaryMap.get(application);
|
||||
return mapHistogramSummary.get(application);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -195,7 +195,7 @@ public class FilteredApplicationMapServiceImpl implements FilteredApplicationMap
|
||||
final Map<LinkKey, LinkStatistics> linkStatMap = new HashMap<LinkKey, LinkStatistics>();
|
||||
|
||||
final TimeSeriesStore timeSeriesStore = new DefaultTimeSeriesStoreImpl(range);
|
||||
final Map<Application, ResponseHistogramSummary> responseHistogramSummaryMap = new HashMap<Application, ResponseHistogramSummary>();
|
||||
final MapResponseHistogramSummary mapHistogramSummary = new MapResponseHistogramSummary();
|
||||
/**
|
||||
* 통계정보로 변환한다.
|
||||
*/
|
||||
@@ -207,7 +207,7 @@ public class FilteredApplicationMapServiceImpl implements FilteredApplicationMap
|
||||
final Application srcApplication = createSourceApplication(span, transactionSpanMap);
|
||||
final Application destApplication = new Application(span.getApplicationId(), span.getServiceType());
|
||||
|
||||
recordSpanResponseTime(destApplication, span, responseHistogramSummaryMap);
|
||||
recordSpanResponseTime(destApplication, span, mapHistogramSummary);
|
||||
|
||||
// record해야 되거나. rpc콜은 링크이다.
|
||||
if (!destApplication.getServiceType().isRecordStatistics() || destApplication.getServiceType().isRpcClient()) {
|
||||
@@ -243,7 +243,7 @@ public class FilteredApplicationMapServiceImpl implements FilteredApplicationMap
|
||||
List<LinkStatistics> linkStatisticsList = new ArrayList<LinkStatistics>(linkStatMap.values());
|
||||
ApplicationMap map = new ApplicationMapBuilder().build(linkStatisticsList);
|
||||
map.setTimeSeriesStore(timeSeriesStore);
|
||||
map.appendResponseTime(responseHistogramSummaryMap);
|
||||
map.appendResponseTime(mapHistogramSummary);
|
||||
|
||||
|
||||
return map;
|
||||
@@ -260,22 +260,8 @@ public class FilteredApplicationMapServiceImpl implements FilteredApplicationMap
|
||||
return transactionSpanMap;
|
||||
}
|
||||
|
||||
private void recordSpanResponseTime(Application application, SpanBo span, Map<Application, ResponseHistogramSummary> responseHistogramSummaryMap) {
|
||||
|
||||
ResponseHistogramSummary responseHistogramSummary = responseHistogramSummaryMap.get(application);
|
||||
if (responseHistogramSummary == null) {
|
||||
responseHistogramSummary = new ResponseHistogramSummary(application);
|
||||
responseHistogramSummaryMap.put(application, responseHistogramSummary);
|
||||
}
|
||||
|
||||
Histogram histogram = new Histogram(application.getServiceType());
|
||||
if (span.getErrCode() != 0) {
|
||||
histogram.addElapsedTime(HistogramSchema.ERROR_SLOT_TIME);
|
||||
} else {
|
||||
histogram.addElapsedTime(span.getElapsed());
|
||||
}
|
||||
responseHistogramSummary.addApplicationLevelHistogram(histogram);
|
||||
responseHistogramSummary.addAgentLevelHistogram(span.getAgentId(), histogram);
|
||||
private void recordSpanResponseTime(Application application, SpanBo span, MapResponseHistogramSummary mapResponseHistogramSummary) {
|
||||
mapResponseHistogramSummary.addHistogram(application, span);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.nhn.pinpoint.web.vo;
|
||||
|
||||
import com.nhn.pinpoint.common.HistogramSchema;
|
||||
import com.nhn.pinpoint.common.bo.Span;
|
||||
import com.nhn.pinpoint.common.bo.SpanBo;
|
||||
import com.nhn.pinpoint.web.applicationmap.rawdata.Histogram;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author emeroad
|
||||
*/
|
||||
public class MapResponseHistogramSummary {
|
||||
|
||||
private final Map<Application, ResponseHistogramSummary> responseHistogramSummaryMap = new HashMap<Application, ResponseHistogramSummary>();
|
||||
|
||||
|
||||
public void addHistogram(Application application, SpanBo span) {
|
||||
|
||||
ResponseHistogramSummary responseHistogramSummary = getResponseHistogram(application);
|
||||
|
||||
Histogram histogram = new Histogram(application.getServiceType());
|
||||
if (span.getErrCode() != 0) {
|
||||
histogram.addElapsedTime(HistogramSchema.ERROR_SLOT_TIME);
|
||||
} else {
|
||||
histogram.addElapsedTime(span.getElapsed());
|
||||
}
|
||||
responseHistogramSummary.addApplicationLevelHistogram(histogram);
|
||||
responseHistogramSummary.addAgentLevelHistogram(span.getAgentId(), histogram);
|
||||
}
|
||||
|
||||
private ResponseHistogramSummary getResponseHistogram(Application application) {
|
||||
ResponseHistogramSummary responseHistogramSummary = responseHistogramSummaryMap.get(application);
|
||||
if (responseHistogramSummary == null) {
|
||||
responseHistogramSummary = new ResponseHistogramSummary(application);
|
||||
responseHistogramSummaryMap.put(application, responseHistogramSummary);
|
||||
}
|
||||
return responseHistogramSummary;
|
||||
}
|
||||
|
||||
public ResponseHistogramSummary get(Application application) {
|
||||
return this.responseHistogramSummaryMap.get(application);
|
||||
}
|
||||
}
|
||||
@@ -35,7 +35,7 @@
|
||||
"isWas" : ${node.serviceType.was},
|
||||
<c:if test="${node.serviceType.was || node.serviceType.terminal || node.serviceType.unknown || node.serviceType.user}" >
|
||||
"histogram" : ${node.responseHistogramSummary.total.json},
|
||||
"agentHistogramMap" : {
|
||||
"agentHistogram" : {
|
||||
<c:forEach items="${node.responseHistogramSummary.agentHistogramMap}" var="agentHistogramMap" varStatus="agentHistogramStatus">
|
||||
"${agentHistogramMap.key}" : ${agentHistogramMap.value.json}
|
||||
<c:if test="${!agentHistogramStatus.last}">,</c:if>
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
"isWas" : ${node.serviceType.was},
|
||||
<c:if test="${node.serviceType.was || node.serviceType.terminal || node.serviceType.unknown || node.serviceType.user}" >
|
||||
"histogram" : ${node.responseHistogramSummary.total.json},
|
||||
"agentHistogramMap" : {
|
||||
"agentHistogram" : {
|
||||
<c:forEach items="${node.responseHistogramSummary.agentHistogramMap}" var="agentHistogramMap" varStatus="agentHistogramStatus">
|
||||
"${agentHistogramMap.key}" : ${agentHistogramMap.value.json}
|
||||
<c:if test="${!agentHistogramStatus.last}">,</c:if>
|
||||
|
||||
Reference in New Issue
Block a user