mirror of
https://github.com/wahyd4/pinpoint.git
synced 2026-08-17 08:46:22 +10:00
[강운덕] [WEB-57] link의 자료 구조 수정. link가 lowlevel의 RawCallData를 갖도록 수정함.
Collection<LinkStatistics>가 아니라 LinkStatisticsData가 직접 데이터의 집합을 가지고 있도록 수정함. git-svn-id: http://svn.bds.nhncorp.com/pe/hippo-web/trunk@3482 84d0f5b1-2673-498c-a247-62c4ff18d310
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
package com.nhn.pinpoint.web.applicationmap;
|
||||
|
||||
import com.nhn.pinpoint.common.bo.AgentInfoBo;
|
||||
import com.nhn.pinpoint.web.applicationmap.rawdata.CallHistogramList;
|
||||
import com.nhn.pinpoint.web.applicationmap.rawdata.LinkStatistics;
|
||||
import com.nhn.pinpoint.web.applicationmap.rawdata.LinkStatisticsData;
|
||||
import com.nhn.pinpoint.web.applicationmap.rawdata.RawCallDataMap;
|
||||
import com.nhn.pinpoint.web.vo.Application;
|
||||
import com.nhn.pinpoint.web.vo.Range;
|
||||
import org.slf4j.Logger;
|
||||
@@ -28,11 +28,10 @@ public class ApplicationMapBuilder {
|
||||
this.range = range;
|
||||
}
|
||||
|
||||
public ApplicationMap build(Collection<LinkStatistics> linkStatistics) {
|
||||
if (linkStatistics == null) {
|
||||
public ApplicationMap build(LinkStatisticsData linkStatisticsData) {
|
||||
if (linkStatisticsData == null) {
|
||||
throw new NullPointerException("linkStatData must not be null");
|
||||
}
|
||||
final LinkStatisticsData linkStatisticsData = new LinkStatisticsData(linkStatistics);
|
||||
|
||||
final ApplicationMap nodeMap = new ApplicationMap(range);
|
||||
|
||||
@@ -69,9 +68,9 @@ public class ApplicationMapBuilder {
|
||||
}
|
||||
|
||||
// RPC client인 경우 dest application이 이미 있으면 삭제, 없으면 unknown cloud로 변경.
|
||||
CallHistogramList toCallHistogramList = linkStat.getTargetList();
|
||||
Link link = new Link(fromNode, toNode, toCallHistogramList);
|
||||
link.setSourceList(linkStat.getSourceList());
|
||||
RawCallDataMap callDataMap = new RawCallDataMap(linkStat.getCallDataMap());
|
||||
final Link link = new Link(fromNode, toNode, range, callDataMap);
|
||||
|
||||
if (toNode.getServiceType().isRpcClient()) {
|
||||
if (!nodeMap.containsApplicationName(toNode.getApplicationName())) {
|
||||
result.add(link);
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
package com.nhn.pinpoint.web.applicationmap;
|
||||
|
||||
import com.nhn.pinpoint.common.ServiceType;
|
||||
import com.nhn.pinpoint.web.applicationmap.rawdata.CallHistogram;
|
||||
import com.nhn.pinpoint.web.applicationmap.rawdata.CallHistogramList;
|
||||
import com.nhn.pinpoint.web.applicationmap.rawdata.Histogram;
|
||||
import com.nhn.pinpoint.web.applicationmap.rawdata.*;
|
||||
import com.nhn.pinpoint.web.vo.LinkKey;
|
||||
import com.nhn.pinpoint.web.vo.Application;
|
||||
import com.nhn.pinpoint.web.vo.Range;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@@ -19,17 +18,18 @@ public class Link {
|
||||
private final Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
|
||||
public static final String LINK_DELIMITER = "~";
|
||||
|
||||
private final LinkKey linkKey;
|
||||
|
||||
private final Node fromNode;
|
||||
private final Node toNode;
|
||||
private final Range range;
|
||||
|
||||
private final CallHistogramList targetList;
|
||||
private CallHistogramList sourceList;
|
||||
private final RawCallDataMap rawCallDataMap;
|
||||
|
||||
|
||||
public Link(Node from, Node to, CallHistogramList targetList) {
|
||||
this(createLinkKey(from, to), from, to, targetList);
|
||||
public Link(Node from, Node to, Range range, RawCallDataMap rawCallDataMap) {
|
||||
this(createLinkKey(from, to), from, to, range, rawCallDataMap);
|
||||
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ public class Link {
|
||||
return new LinkKey(fromApplication, toApplication);
|
||||
}
|
||||
|
||||
Link(LinkKey linkKey, Node fromNode, Node toNode, CallHistogramList targetList) {
|
||||
Link(LinkKey linkKey, Node fromNode, Node toNode, Range range, RawCallDataMap rawCallDataMap) {
|
||||
if (fromNode == null) {
|
||||
throw new NullPointerException("fromNode must not be null");
|
||||
}
|
||||
@@ -55,10 +55,16 @@ public class Link {
|
||||
if (linkKey == null) {
|
||||
throw new NullPointerException("linkKey must not be null");
|
||||
}
|
||||
if (rawCallDataMap == null) {
|
||||
throw new NullPointerException("rawCallDataMap must not be null");
|
||||
}
|
||||
|
||||
this.linkKey = linkKey;
|
||||
this.fromNode = fromNode;
|
||||
this.toNode = toNode;
|
||||
this.targetList = targetList;
|
||||
|
||||
this.range = range;
|
||||
this.rawCallDataMap = rawCallDataMap;
|
||||
}
|
||||
|
||||
public Link(Link copyLink) {
|
||||
@@ -68,8 +74,8 @@ public class Link {
|
||||
this.linkKey = copyLink.linkKey;
|
||||
this.fromNode = copyLink.fromNode;
|
||||
this.toNode = copyLink.toNode;
|
||||
this.targetList = new CallHistogramList(copyLink.targetList);
|
||||
this.sourceList = new CallHistogramList(copyLink.sourceList);
|
||||
this.rawCallDataMap = new RawCallDataMap(copyLink.rawCallDataMap);
|
||||
this.range = copyLink.range;
|
||||
}
|
||||
|
||||
public Application getFilterApplication() {
|
||||
@@ -99,7 +105,7 @@ public class Link {
|
||||
}
|
||||
|
||||
public CallHistogramList getTargetList() {
|
||||
return targetList;
|
||||
return rawCallDataMap.getTargetList();
|
||||
}
|
||||
|
||||
|
||||
@@ -107,18 +113,14 @@ public class Link {
|
||||
// 내가 호출하는 대상의 serviceType을 가져와야 한다.
|
||||
// tomcat -> arcus를 호출한다고 하였을 경우 arcus의 타입을 가져와야함.
|
||||
final Histogram linkHistogram = new Histogram(toNode.getServiceType());
|
||||
for (CallHistogram callHistogram : targetList.getCallHistogramList()) {
|
||||
for (CallHistogram callHistogram : rawCallDataMap.getTargetList().getCallHistogramList()) {
|
||||
linkHistogram.addUncheckType(callHistogram.getHistogram());
|
||||
}
|
||||
return linkHistogram;
|
||||
}
|
||||
|
||||
public void setSourceList(CallHistogramList sourceList) {
|
||||
this.sourceList = sourceList;
|
||||
}
|
||||
|
||||
public CallHistogramList getSourceList() {
|
||||
return sourceList;
|
||||
return rawCallDataMap.getTargetList();
|
||||
}
|
||||
|
||||
public void addLink(Link link) {
|
||||
@@ -130,10 +132,8 @@ public class Link {
|
||||
logger.info("fromNode:{}, to:{}, fromNode:{}, linkTo:{}", fromNode, toNode, link.getFrom(), link.getTo());
|
||||
throw new IllegalArgumentException("Can't merge.");
|
||||
}
|
||||
|
||||
CallHistogramList linkCallHistogramList = link.getTargetList();
|
||||
this.targetList.addCallHistogram(linkCallHistogramList);
|
||||
this.sourceList.addCallHistogram(link.getSourceList());
|
||||
RawCallDataMap copyRawCallDataMap= link.rawCallDataMap;
|
||||
this.rawCallDataMap.addCallData(copyRawCallDataMap);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -163,7 +163,7 @@ public class Link {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Link [linkKey=" + linkKey + ", fromNode=" + fromNode + ", toNode=" + toNode + ", targetList=" + targetList + "]";
|
||||
return "Link [linkKey=" + linkKey + ", fromNode=" + fromNode + ", toNode=" + toNode + ", rawCallDataMap=" + rawCallDataMap + "]";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -85,6 +85,9 @@ public class CallHistogram {
|
||||
}
|
||||
|
||||
public void addTimeHistogram(Collection<TimeHistogram> histogramList) {
|
||||
if (histogramList == null) {
|
||||
throw new NullPointerException("histogramList must not be null");
|
||||
}
|
||||
for (TimeHistogram timeHistogram : histogramList) {
|
||||
addTimeHistogram(timeHistogram);
|
||||
}
|
||||
|
||||
@@ -26,8 +26,8 @@ public class CallHistogramList {
|
||||
|
||||
for (Map.Entry<Application, CallHistogram> copyEntry : copyCallHistogramList.callHistogramMap.entrySet()) {
|
||||
Application copyKey = copyEntry.getKey();
|
||||
CallHistogram copyValue = new CallHistogram(copyEntry.getValue());
|
||||
this.callHistogramMap.put(copyKey, copyValue);
|
||||
CallHistogram newCallHistogram = new CallHistogram(copyEntry.getValue());
|
||||
this.callHistogramMap.put(copyKey, newCallHistogram);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,21 +39,26 @@ public class CallHistogramList {
|
||||
if (serviceType == null) {
|
||||
throw new NullPointerException("serviceType must not be null");
|
||||
}
|
||||
|
||||
if (histogramList == null) {
|
||||
throw new NullPointerException("histogramList must not be null");
|
||||
}
|
||||
CallHistogram callHistogram = getCallHistogram(agentName, serviceType);
|
||||
callHistogram.addTimeHistogram(histogramList);
|
||||
}
|
||||
|
||||
|
||||
public void addCallHistogramUncheck(String hostName, ServiceType serviceType, Collection<TimeHistogram> histogram) {
|
||||
public void addCallHistogramUncheck(String hostName, ServiceType serviceType, Collection<TimeHistogram> histogramList) {
|
||||
if (hostName == null) {
|
||||
throw new NullPointerException("histogram must not be null");
|
||||
throw new NullPointerException("hostName must not be null");
|
||||
}
|
||||
if (serviceType == null) {
|
||||
throw new NullPointerException("serviceType must not be null");
|
||||
}
|
||||
if (histogramList == null) {
|
||||
throw new NullPointerException("histogramList must not be null");
|
||||
}
|
||||
CallHistogram callHistogram = getCallHistogram(hostName, serviceType);
|
||||
callHistogram.addTimeHistogramUncheckType(histogram);
|
||||
callHistogram.addTimeHistogramUncheckType(histogramList);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
package com.nhn.pinpoint.web.applicationmap.rawdata;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import com.nhn.pinpoint.common.ServiceType;
|
||||
import com.nhn.pinpoint.common.bo.AgentInfoBo;
|
||||
import com.nhn.pinpoint.web.vo.Application;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* DB에서 조회한 application호출 관계 정보.
|
||||
@@ -13,13 +16,15 @@ import com.nhn.pinpoint.web.vo.Application;
|
||||
* @author emeroad
|
||||
*/
|
||||
public class LinkStatistics {
|
||||
private final Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
|
||||
private Application fromApplication;
|
||||
|
||||
private final Application fromApplication;
|
||||
private Application toApplication;
|
||||
|
||||
private RawCallDataMap callDataMap;
|
||||
private final RawCallDataMap callDataMap;
|
||||
|
||||
private Set<AgentInfoBo> toAgentSet;
|
||||
private final Set<AgentInfoBo> toAgentSet;
|
||||
|
||||
public LinkStatistics(Application fromApplication, Application toApplication) {
|
||||
if (fromApplication == null) {
|
||||
@@ -31,6 +36,8 @@ public class LinkStatistics {
|
||||
this.fromApplication = fromApplication;
|
||||
this.toApplication = toApplication;
|
||||
|
||||
this.toAgentSet = new HashSet<AgentInfoBo>();
|
||||
|
||||
this.callDataMap = new RawCallDataMap();
|
||||
}
|
||||
|
||||
@@ -62,8 +69,9 @@ public class LinkStatistics {
|
||||
return this.toApplication;
|
||||
}
|
||||
|
||||
|
||||
public String getTo() {
|
||||
return toApplication.getName();
|
||||
return getToApplication().getName();
|
||||
}
|
||||
|
||||
public ServiceType getFromServiceType() {
|
||||
@@ -71,18 +79,18 @@ public class LinkStatistics {
|
||||
}
|
||||
|
||||
public ServiceType getToServiceType() {
|
||||
return toApplication.getServiceType();
|
||||
return getToApplication().getServiceType();
|
||||
}
|
||||
|
||||
public void setFromApplication(Application fromApplication) {
|
||||
this.fromApplication = fromApplication;
|
||||
}
|
||||
|
||||
public void setToApplication(Application toApplication) {
|
||||
this.toApplication = toApplication;
|
||||
}
|
||||
|
||||
public CallHistogramList getTargetList() {
|
||||
public RawCallDataMap getCallDataMap() {
|
||||
return this.callDataMap;
|
||||
}
|
||||
|
||||
public CallHistogramList getTargetList() {
|
||||
return callDataMap.getTargetList();
|
||||
}
|
||||
|
||||
@@ -94,13 +102,12 @@ public class LinkStatistics {
|
||||
return toAgentSet;
|
||||
}
|
||||
|
||||
public void addToAgentSet(Set<AgentInfoBo> agentSet) {
|
||||
if (this.toAgentSet != null) {
|
||||
this.toAgentSet.addAll(agentSet);
|
||||
} else {
|
||||
this.toAgentSet = agentSet;
|
||||
}
|
||||
}
|
||||
public void addToAgentSet(Set<AgentInfoBo> agentSet) {
|
||||
if (agentSet == null) {
|
||||
throw new NullPointerException("agentSet must not be null");
|
||||
}
|
||||
this.toAgentSet.addAll(agentSet);
|
||||
}
|
||||
|
||||
public void add(final LinkStatistics applicationStatistics) {
|
||||
if (applicationStatistics == null) {
|
||||
|
||||
@@ -4,25 +4,27 @@ import java.util.*;
|
||||
|
||||
import com.nhn.pinpoint.common.bo.AgentInfoBo;
|
||||
import com.nhn.pinpoint.web.vo.Application;
|
||||
import com.nhn.pinpoint.web.vo.LinkKey;
|
||||
|
||||
public class LinkStatisticsData {
|
||||
|
||||
private final Collection<LinkStatistics> linkStatData;
|
||||
private final Map<LinkKey, LinkStatistics> linkStatData = new HashMap<LinkKey, LinkStatistics>();
|
||||
|
||||
public LinkStatisticsData(Collection<LinkStatistics> linkStatData) {
|
||||
if (linkStatData == null) {
|
||||
throw new NullPointerException("linkStatData must not be null");
|
||||
}
|
||||
this.linkStatData = linkStatData;
|
||||
public LinkStatisticsData() {
|
||||
}
|
||||
|
||||
public Collection<LinkStatistics> getLinkStatData() {
|
||||
return linkStatData;
|
||||
return linkStatData.values();
|
||||
}
|
||||
|
||||
public void addCallData(Application srcApplication, String srcAgentId, Application destApplication, String destAgentId, long timestamp, short slotTime, long value) {
|
||||
LinkStatistics linkStat = getLinkStatistics(srcApplication, destApplication);
|
||||
linkStat.addCallData(srcAgentId, srcApplication.getServiceTypeCode(), destAgentId, destApplication.getServiceTypeCode(), timestamp, slotTime, value);
|
||||
}
|
||||
|
||||
public Map<Application, Set<AgentInfoBo>> getAgentMap() {
|
||||
final Map<Application, Set<AgentInfoBo>> agentMap = new HashMap<Application, Set<AgentInfoBo>>();
|
||||
for (LinkStatistics stat : linkStatData) {
|
||||
for (LinkStatistics stat : linkStatData.values()) {
|
||||
if (stat.getToAgentSet() == null) {
|
||||
continue;
|
||||
}
|
||||
@@ -44,4 +46,37 @@ public class LinkStatisticsData {
|
||||
public String toString() {
|
||||
return "LinkStatisticsData [linkStatData=" + linkStatData + "]";
|
||||
}
|
||||
|
||||
public void addLinkStatisticsData(LinkStatisticsData linkStatisticsData) {
|
||||
if (linkStatisticsData == null) {
|
||||
throw new NullPointerException("linkStatisticsData must not be null");
|
||||
}
|
||||
for (LinkStatistics copyLinkStatistics : linkStatisticsData.linkStatData.values()) {
|
||||
addLinkStatistics(copyLinkStatistics);
|
||||
}
|
||||
}
|
||||
|
||||
public void addLinkStatistics(LinkStatistics copyLinkStatistics) {
|
||||
if (copyLinkStatistics == null) {
|
||||
throw new NullPointerException("copyLinkStatistics must not be null");
|
||||
}
|
||||
Application fromApplication = copyLinkStatistics.getFromApplication();
|
||||
Application toApplication = copyLinkStatistics.getToApplication();
|
||||
LinkStatistics linkStatistics = getLinkStatistics(fromApplication, toApplication);
|
||||
linkStatistics.add(copyLinkStatistics);
|
||||
}
|
||||
|
||||
private LinkStatistics getLinkStatistics(Application fromApplication, Application toApplication) {
|
||||
final LinkKey key = new LinkKey(fromApplication, toApplication);
|
||||
LinkStatistics findLink = linkStatData.get(key);
|
||||
if (findLink == null) {
|
||||
findLink = new LinkStatistics(fromApplication, toApplication);
|
||||
linkStatData.put(key, findLink);
|
||||
}
|
||||
return findLink;
|
||||
}
|
||||
|
||||
public int size() {
|
||||
return linkStatData.size();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,11 +38,7 @@ public class RawCallData {
|
||||
}
|
||||
|
||||
public void addCallData(long timestamp, short slot, long count) {
|
||||
TimeHistogram histogram = targetHistogramTimeMap.get(timestamp);
|
||||
if (histogram == null) {
|
||||
histogram = new TimeHistogram(targetServiceType, timestamp);
|
||||
targetHistogramTimeMap.put(timestamp, histogram);
|
||||
}
|
||||
TimeHistogram histogram = getTimeHistogram(timestamp);
|
||||
histogram.addCallCount(slot, count);
|
||||
}
|
||||
|
||||
@@ -65,12 +61,17 @@ public class RawCallData {
|
||||
|
||||
for (Map.Entry<Long, TimeHistogram> copyEntry : copyRawCallData.targetHistogramTimeMap.entrySet()) {
|
||||
final Long timeStamp = copyEntry.getKey();
|
||||
TimeHistogram histogram = targetHistogramTimeMap.get(timeStamp);
|
||||
if (histogram == null) {
|
||||
histogram = new TimeHistogram(targetServiceType, timeStamp);
|
||||
targetHistogramTimeMap.put(timeStamp, histogram);
|
||||
}
|
||||
TimeHistogram histogram = getTimeHistogram(timeStamp);
|
||||
histogram.add(copyEntry.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
private TimeHistogram getTimeHistogram(Long timeStamp) {
|
||||
TimeHistogram histogram = targetHistogramTimeMap.get(timeStamp);
|
||||
if (histogram == null) {
|
||||
histogram = new TimeHistogram(targetServiceType, timeStamp);
|
||||
targetHistogramTimeMap.put(timeStamp, histogram);
|
||||
}
|
||||
return histogram;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +14,15 @@ public class RawCallDataMap {
|
||||
|
||||
private final Map<LinkKey, RawCallData> rawCallDataMap = new HashMap<LinkKey, RawCallData>();
|
||||
|
||||
public RawCallDataMap() {
|
||||
}
|
||||
|
||||
public RawCallDataMap(RawCallDataMap copyRawCallDataMap) {
|
||||
if (copyRawCallDataMap == null) {
|
||||
throw new NullPointerException("copyRawCallDataMap must not be null");
|
||||
}
|
||||
addCallData(copyRawCallDataMap);
|
||||
}
|
||||
|
||||
public void addCallData(String sourceAgentId, short sourceServiceType, String targetId, short targetServiceType, long timestamp, short slot, long count) {
|
||||
addCallData(sourceAgentId, ServiceType.findServiceType(sourceServiceType), targetId, ServiceType.findServiceType(targetServiceType), timestamp, slot, count);
|
||||
@@ -25,11 +34,14 @@ public class RawCallDataMap {
|
||||
rawCallData.addCallData(timestamp, slot, count);
|
||||
}
|
||||
|
||||
public LinkKey createLinkKey(String sourceAgentId, ServiceType sourceServiceType, String targetId, ServiceType targetServiceType) {
|
||||
private LinkKey createLinkKey(String sourceAgentId, ServiceType sourceServiceType, String targetId, ServiceType targetServiceType) {
|
||||
return new LinkKey(sourceAgentId, sourceServiceType, targetId, targetServiceType);
|
||||
}
|
||||
|
||||
public void addCallData(RawCallDataMap target) {
|
||||
if (target == null) {
|
||||
throw new NullPointerException("target must not be null");
|
||||
}
|
||||
for (Map.Entry<LinkKey, RawCallData> copyEntry : target.rawCallDataMap.entrySet()) {
|
||||
final LinkKey key = copyEntry.getKey();
|
||||
final RawCallData copyRawCallData = copyEntry.getValue();
|
||||
@@ -70,4 +82,5 @@ public class RawCallDataMap {
|
||||
}
|
||||
return sourceList;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
package com.nhn.pinpoint.web.dao;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.nhn.pinpoint.web.applicationmap.rawdata.LinkStatistics;
|
||||
import com.nhn.pinpoint.web.applicationmap.rawdata.LinkStatisticsData;
|
||||
import com.nhn.pinpoint.web.vo.Application;
|
||||
import com.nhn.pinpoint.web.vo.Range;
|
||||
|
||||
@@ -14,7 +12,7 @@ import com.nhn.pinpoint.web.vo.Range;
|
||||
*
|
||||
*/
|
||||
public interface MapStatisticsCalleeDao {
|
||||
public Collection<LinkStatistics> selectCallee(Application calleeApplication, Range range);
|
||||
public LinkStatisticsData selectCallee(Application calleeApplication, Range range);
|
||||
|
||||
public List<Collection<LinkStatistics>> selectCalleeStatistics(Application callerApplication, Application calleeApplication, Range range);
|
||||
public List<LinkStatisticsData> selectCalleeStatistics(Application callerApplication, Application calleeApplication, Range range);
|
||||
}
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
package com.nhn.pinpoint.web.dao;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.nhn.pinpoint.web.applicationmap.rawdata.LinkStatistics;
|
||||
import com.nhn.pinpoint.web.applicationmap.rawdata.LinkStatisticsData;
|
||||
import com.nhn.pinpoint.web.vo.Application;
|
||||
import com.nhn.pinpoint.web.vo.Range;
|
||||
|
||||
@@ -14,7 +12,7 @@ import com.nhn.pinpoint.web.vo.Range;
|
||||
*
|
||||
*/
|
||||
public interface MapStatisticsCallerDao {
|
||||
public Collection<LinkStatistics> selectCaller(Application callerApplication, Range range);
|
||||
LinkStatisticsData selectCaller(Application callerApplication, Range range);
|
||||
|
||||
public List<Collection<LinkStatistics>> selectCallerStatistics(Application callerApplication, Application calleeApplication, Range range);
|
||||
List<LinkStatisticsData> selectCallerStatistics(Application callerApplication, Application calleeApplication, Range range);
|
||||
}
|
||||
|
||||
@@ -5,10 +5,9 @@ import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
|
||||
import com.nhn.pinpoint.web.applicationmap.rawdata.LinkStatisticsData;
|
||||
import com.nhn.pinpoint.web.dao.MapStatisticsCalleeDao;
|
||||
import com.nhn.pinpoint.web.mapper.*;
|
||||
import com.nhn.pinpoint.web.vo.LinkKey;
|
||||
import com.nhn.pinpoint.web.applicationmap.rawdata.LinkStatistics;
|
||||
import com.nhn.pinpoint.web.vo.Application;
|
||||
import com.nhn.pinpoint.web.vo.Range;
|
||||
import org.apache.hadoop.hbase.client.Scan;
|
||||
@@ -41,10 +40,10 @@ public class HbaseMapStatisticsCalleeDao implements MapStatisticsCalleeDao {
|
||||
|
||||
@Autowired
|
||||
@Qualifier("mapStatisticsCalleeMapper")
|
||||
private RowMapper<Collection<LinkStatistics>> mapStatisticsCalleeMapper;
|
||||
private RowMapper<LinkStatisticsData> mapStatisticsCalleeMapper;
|
||||
|
||||
@Override
|
||||
public Collection<LinkStatistics> selectCallee(Application calleeApplication, Range range) {
|
||||
public LinkStatisticsData selectCallee(Application calleeApplication, Range range) {
|
||||
if (calleeApplication == null) {
|
||||
throw new NullPointerException("calleeApplication must not be null");
|
||||
}
|
||||
@@ -52,7 +51,7 @@ public class HbaseMapStatisticsCalleeDao implements MapStatisticsCalleeDao {
|
||||
throw new NullPointerException("range must not be null");
|
||||
}
|
||||
Scan scan = createScan(calleeApplication, range);
|
||||
List<Collection<LinkStatistics>> foundListList = hbaseOperations2.find(HBaseTables.MAP_STATISTICS_CALLER, scan, mapStatisticsCalleeMapper);
|
||||
List<LinkStatisticsData> foundListList = hbaseOperations2.find(HBaseTables.MAP_STATISTICS_CALLER, scan, mapStatisticsCalleeMapper);
|
||||
|
||||
if (foundListList.isEmpty()) {
|
||||
logger.debug("There's no caller data. {}, {}", calleeApplication, range);
|
||||
@@ -61,22 +60,14 @@ public class HbaseMapStatisticsCalleeDao implements MapStatisticsCalleeDao {
|
||||
return merge(foundListList);
|
||||
}
|
||||
|
||||
private Collection<LinkStatistics> merge(List<Collection<LinkStatistics>> foundListList) {
|
||||
final Map<LinkKey, LinkStatistics> result = new HashMap<LinkKey, LinkStatistics>();
|
||||
private LinkStatisticsData merge(List<LinkStatisticsData> foundListList) {
|
||||
final LinkStatisticsData result = new LinkStatisticsData();
|
||||
|
||||
for (Collection<LinkStatistics> foundList : foundListList) {
|
||||
for (LinkStatistics found : foundList) {
|
||||
final LinkKey key = new LinkKey(found.getFromApplication(), found.getToApplication());
|
||||
final LinkStatistics find = result.get(key);
|
||||
if (find != null) {
|
||||
find.add(found);
|
||||
} else {
|
||||
result.put(key, found);
|
||||
}
|
||||
}
|
||||
for (LinkStatisticsData foundList : foundListList) {
|
||||
result.addLinkStatisticsData(foundList);
|
||||
}
|
||||
|
||||
return result.values();
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -96,7 +87,7 @@ public class HbaseMapStatisticsCalleeDao implements MapStatisticsCalleeDao {
|
||||
* </pre>
|
||||
*/
|
||||
@Override
|
||||
public List<Collection<LinkStatistics>> selectCalleeStatistics(Application callerApplication, Application calleeApplication, Range range) {
|
||||
public List<LinkStatisticsData> selectCalleeStatistics(Application callerApplication, Application calleeApplication, Range range) {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("selectCalleeStatistics. {}, {}, {}", callerApplication, calleeApplication, range);
|
||||
}
|
||||
@@ -104,7 +95,7 @@ public class HbaseMapStatisticsCalleeDao implements MapStatisticsCalleeDao {
|
||||
|
||||
|
||||
final LinkFilter filter = new DefaultLinkFilter(callerApplication, calleeApplication);
|
||||
RowMapper<Collection<LinkStatistics>> mapper = new MapStatisticsCalleeMapper(filter);
|
||||
RowMapper<LinkStatisticsData> mapper = new MapStatisticsCalleeMapper(filter);
|
||||
return hbaseOperations2.find(HBaseTables.MAP_STATISTICS_CALLER, scan, mapper);
|
||||
}
|
||||
|
||||
|
||||
@@ -4,10 +4,9 @@ import java.sql.Date;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
import com.nhn.pinpoint.web.applicationmap.rawdata.LinkStatisticsData;
|
||||
import com.nhn.pinpoint.web.dao.MapStatisticsCallerDao;
|
||||
import com.nhn.pinpoint.web.mapper.*;
|
||||
import com.nhn.pinpoint.web.vo.LinkKey;
|
||||
import com.nhn.pinpoint.web.applicationmap.rawdata.LinkStatistics;
|
||||
import com.nhn.pinpoint.web.vo.Application;
|
||||
import com.nhn.pinpoint.web.vo.Range;
|
||||
import org.apache.hadoop.hbase.client.Scan;
|
||||
@@ -40,37 +39,26 @@ public class HbaseMapStatisticsCallerDao implements MapStatisticsCallerDao {
|
||||
|
||||
@Autowired
|
||||
@Qualifier("mapStatisticsCallerMapper")
|
||||
private RowMapper<Collection<LinkStatistics>> mapStatisticsCallerMapper;
|
||||
private RowMapper<LinkStatisticsData> mapStatisticsCallerMapper;
|
||||
|
||||
@Override
|
||||
public Collection<LinkStatistics> selectCaller(Application callerApplication, Range range) {
|
||||
public LinkStatisticsData selectCaller(Application callerApplication, Range range) {
|
||||
Scan scan = createScan(callerApplication, range);
|
||||
final List<Collection<LinkStatistics>> foundListList = hbaseOperations2.find(HBaseTables.MAP_STATISTICS_CALLEE, scan, mapStatisticsCallerMapper);
|
||||
final List<LinkStatisticsData> foundList = hbaseOperations2.find(HBaseTables.MAP_STATISTICS_CALLEE, scan, mapStatisticsCallerMapper);
|
||||
|
||||
if (foundListList.isEmpty()) {
|
||||
if (foundList.isEmpty()) {
|
||||
logger.debug("There's no caller data. {}, {}", callerApplication, range);
|
||||
}
|
||||
// 시계열 데이터가 토탈 머지 데이터로 변경되는듯함.
|
||||
return merge(foundListList);
|
||||
return merge(foundList);
|
||||
}
|
||||
|
||||
private Collection<LinkStatistics> merge(List<Collection<LinkStatistics>> foundListList) {
|
||||
final Map<LinkKey, LinkStatistics> result = new HashMap<LinkKey, LinkStatistics>();
|
||||
|
||||
for (Collection<LinkStatistics> foundList : foundListList) {
|
||||
for (LinkStatistics found : foundList) {
|
||||
final LinkKey key = new LinkKey(found.getFromApplication(), found.getToApplication());
|
||||
final LinkStatistics find = result.get(key);
|
||||
if (find != null) {
|
||||
find.add(found);
|
||||
} else {
|
||||
result.put(key, found);
|
||||
}
|
||||
}
|
||||
private LinkStatisticsData merge(List<LinkStatisticsData> foundList) {
|
||||
final LinkStatisticsData result = new LinkStatisticsData();
|
||||
for (LinkStatisticsData foundData : foundList) {
|
||||
result.addLinkStatisticsData(foundData);
|
||||
}
|
||||
|
||||
|
||||
return result.values();
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -89,14 +77,14 @@ public class HbaseMapStatisticsCallerDao implements MapStatisticsCallerDao {
|
||||
* </pre>
|
||||
*/
|
||||
@Override
|
||||
public List<Collection<LinkStatistics>> selectCallerStatistics(Application callerApplication, Application calleeApplication, Range range) {
|
||||
public List<LinkStatisticsData> selectCallerStatistics(Application callerApplication, Application calleeApplication, Range range) {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("selectCallerStatistics. {}, {}, {}", callerApplication, calleeApplication, range);
|
||||
}
|
||||
Scan scan = createScan(callerApplication, range);
|
||||
|
||||
final LinkFilter filter = new DefaultLinkFilter(callerApplication, calleeApplication);
|
||||
RowMapper<Collection<LinkStatistics>> mapper = new MapStatisticsCallerMapper(filter);
|
||||
RowMapper<LinkStatisticsData> mapper = new MapStatisticsCallerMapper(filter);
|
||||
return hbaseOperations2.find(HBaseTables.MAP_STATISTICS_CALLEE, scan, mapper);
|
||||
}
|
||||
|
||||
|
||||
@@ -5,9 +5,8 @@ import java.util.*;
|
||||
import com.nhn.pinpoint.common.buffer.Buffer;
|
||||
import com.nhn.pinpoint.common.buffer.FixedBuffer;
|
||||
import com.nhn.pinpoint.common.util.TimeUtils;
|
||||
import com.nhn.pinpoint.web.applicationmap.rawdata.LinkStatistics;
|
||||
import com.nhn.pinpoint.web.applicationmap.rawdata.LinkStatisticsData;
|
||||
import com.nhn.pinpoint.web.vo.Application;
|
||||
import com.nhn.pinpoint.web.vo.LinkKey;
|
||||
import org.apache.hadoop.hbase.KeyValue;
|
||||
import org.apache.hadoop.hbase.client.Result;
|
||||
import org.apache.hadoop.hbase.util.Bytes;
|
||||
@@ -24,7 +23,7 @@ import com.nhn.pinpoint.common.util.ApplicationMapStatisticsUtils;
|
||||
*
|
||||
*/
|
||||
@Component
|
||||
public class MapStatisticsCalleeMapper implements RowMapper<Collection<LinkStatistics>> {
|
||||
public class MapStatisticsCalleeMapper implements RowMapper<LinkStatisticsData> {
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
|
||||
@@ -42,9 +41,9 @@ public class MapStatisticsCalleeMapper implements RowMapper<Collection<LinkStati
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<LinkStatistics> mapRow(Result result, int rowNum) throws Exception {
|
||||
public LinkStatisticsData mapRow(Result result, int rowNum) throws Exception {
|
||||
if (result.isEmpty()) {
|
||||
return Collections.emptyList();
|
||||
return new LinkStatisticsData();
|
||||
}
|
||||
logger.debug("mapRow:{}", rowNum);
|
||||
|
||||
@@ -53,7 +52,7 @@ public class MapStatisticsCalleeMapper implements RowMapper<Collection<LinkStati
|
||||
final long timestamp = TimeUtils.recoveryTimeMillis(row.readLong());
|
||||
|
||||
|
||||
final Map<LinkKey, LinkStatistics> linkStatisticsMap = new HashMap<LinkKey, LinkStatistics>();
|
||||
final LinkStatisticsData linkStatisticsData = new LinkStatisticsData();
|
||||
for (KeyValue kv : result.raw()) {
|
||||
|
||||
final byte[] qualifier = kv.getQualifier();
|
||||
@@ -72,27 +71,18 @@ public class MapStatisticsCalleeMapper implements RowMapper<Collection<LinkStati
|
||||
logger.debug(" Fetched Callee. {} callerHost:{} -> {} (slot:{}/{}), ", callerApplication, callerHost, calleeApplication, histogramSlot, requestCount);
|
||||
}
|
||||
|
||||
LinkStatistics statistics = getLinkStatics(linkStatisticsMap, callerApplication, calleeApplication);
|
||||
statistics.addCallData(callerApplication.getName(), callerApplication.getServiceTypeCode(), callerHost, calleeApplication.getServiceTypeCode(), timestamp, (isError) ? (short) -1 : histogramSlot, requestCount);
|
||||
|
||||
final short slotTime = (isError) ? (short) -1 : histogramSlot;
|
||||
linkStatisticsData.addCallData(callerApplication, callerApplication.getName(), calleeApplication, callerHost, timestamp, slotTime, requestCount);
|
||||
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug(" Fetched Callee. statistics:{}", statistics);
|
||||
logger.debug(" Fetched Callee. statistics:{}", linkStatisticsData);
|
||||
}
|
||||
}
|
||||
|
||||
return linkStatisticsMap.values();
|
||||
return linkStatisticsData;
|
||||
}
|
||||
|
||||
private LinkStatistics getLinkStatics(Map<LinkKey, LinkStatistics> linkStatisticsMap, Application callerApplication, Application calleeApplication) {
|
||||
final LinkKey key = new LinkKey(callerApplication, calleeApplication);
|
||||
LinkStatistics statistics = linkStatisticsMap.get(key);
|
||||
if (statistics == null) {
|
||||
statistics = new LinkStatistics(callerApplication, calleeApplication);
|
||||
linkStatisticsMap.put(key, statistics);
|
||||
}
|
||||
return statistics;
|
||||
}
|
||||
|
||||
private Application readCallerApplication(byte[] qualifier) {
|
||||
String callerApplicationName = ApplicationMapStatisticsUtils.getDestApplicationNameFromColumnName(qualifier);
|
||||
short callerServiceType = ApplicationMapStatisticsUtils.getDestServiceTypeFromColumnName(qualifier);
|
||||
|
||||
@@ -7,9 +7,8 @@ import com.nhn.pinpoint.common.buffer.FixedBuffer;
|
||||
import com.nhn.pinpoint.common.buffer.OffsetFixedBuffer;
|
||||
import com.nhn.pinpoint.common.hbase.HBaseTables;
|
||||
import com.nhn.pinpoint.common.util.TimeUtils;
|
||||
import com.nhn.pinpoint.web.applicationmap.rawdata.LinkStatistics;
|
||||
import com.nhn.pinpoint.web.applicationmap.rawdata.LinkStatisticsData;
|
||||
import com.nhn.pinpoint.web.vo.Application;
|
||||
import com.nhn.pinpoint.web.vo.LinkKey;
|
||||
import org.apache.hadoop.hbase.KeyValue;
|
||||
import org.apache.hadoop.hbase.client.Result;
|
||||
import org.apache.hadoop.hbase.util.Bytes;
|
||||
@@ -27,7 +26,7 @@ import com.nhn.pinpoint.common.util.ApplicationMapStatisticsUtils;
|
||||
*
|
||||
*/
|
||||
@Component
|
||||
public class MapStatisticsCallerMapper implements RowMapper<Collection<LinkStatistics>> {
|
||||
public class MapStatisticsCallerMapper implements RowMapper<LinkStatisticsData> {
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
|
||||
@@ -45,9 +44,9 @@ public class MapStatisticsCallerMapper implements RowMapper<Collection<LinkStati
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<LinkStatistics> mapRow(Result result, int rowNum) throws Exception {
|
||||
public LinkStatisticsData mapRow(Result result, int rowNum) throws Exception {
|
||||
if (result.isEmpty()) {
|
||||
return Collections.emptyList();
|
||||
return new LinkStatisticsData();
|
||||
}
|
||||
logger.debug("mapRow:{}", rowNum);
|
||||
|
||||
@@ -56,7 +55,7 @@ public class MapStatisticsCallerMapper implements RowMapper<Collection<LinkStati
|
||||
final long timestamp = TimeUtils.recoveryTimeMillis(row.readLong());
|
||||
|
||||
// key is destApplicationName.
|
||||
final Map<LinkKey, LinkStatistics> linkStatisticsMap = new HashMap<LinkKey, LinkStatistics>();
|
||||
final LinkStatisticsData linkStatisticsMap = new LinkStatisticsData();
|
||||
for (KeyValue kv : result.raw()) {
|
||||
final byte[] family = kv.getFamily();
|
||||
if (Bytes.equals(family, HBaseTables.MAP_STATISTICS_CALLEE_CF_COUNTER)) {
|
||||
@@ -77,8 +76,10 @@ public class MapStatisticsCallerMapper implements RowMapper<Collection<LinkStati
|
||||
logger.debug(" Fetched Caller. {} -> {} (slot:{}/{}) calleeHost:{}", caller, callee, histogramSlot, requestCount, calleeHost);
|
||||
}
|
||||
|
||||
LinkStatistics statistics = getLinkStatistics(linkStatisticsMap, caller, callee);
|
||||
statistics.addCallData(caller.getName(), caller.getServiceTypeCode(), calleeHost, callee.getServiceTypeCode(), timestamp, (isError) ? (short) -1 : histogramSlot, requestCount);
|
||||
final short slotTime = (isError) ? (short) -1 : histogramSlot;
|
||||
linkStatisticsMap.addCallData(caller, caller.getName(), callee, calleeHost, timestamp, slotTime, requestCount);
|
||||
|
||||
|
||||
} else if (Bytes.equals(family, HBaseTables.MAP_STATISTICS_CALLEE_CF_VER2_COUNTER)) {
|
||||
|
||||
final Buffer buffer = new OffsetFixedBuffer(kv.getBuffer(), kv.getQualifierOffset());
|
||||
@@ -99,30 +100,21 @@ public class MapStatisticsCallerMapper implements RowMapper<Collection<LinkStati
|
||||
logger.debug(" Fetched Caller.(New) {} {} -> {} (slot:{}/{}) calleeHost:{}", caller, callerAgentId, callee, histogramSlot, requestCount, calleeHost);
|
||||
}
|
||||
|
||||
LinkStatistics statistics = getLinkStatistics(linkStatisticsMap, caller, callee);
|
||||
statistics.addCallData(callerAgentId, caller.getServiceTypeCode(), calleeHost, callee.getServiceTypeCode(), timestamp, (isError) ? (short) -1 : histogramSlot, requestCount);
|
||||
final short slotTime = (isError) ? (short) -1 : histogramSlot;
|
||||
linkStatisticsMap.addCallData(caller, callerAgentId, callee, calleeHost, timestamp, slotTime, requestCount);
|
||||
} else {
|
||||
throw new IllegalArgumentException("unknown ColumnFamily :" + Arrays.toString(family));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return linkStatisticsMap.values();
|
||||
return linkStatisticsMap;
|
||||
}
|
||||
|
||||
private long getValueToLong(KeyValue kv) {
|
||||
return Bytes.toLong(kv.getBuffer(), kv.getValueOffset());
|
||||
}
|
||||
|
||||
private LinkStatistics getLinkStatistics(Map<LinkKey, LinkStatistics> linkStatisticsMap, Application caller, Application callee) {
|
||||
final LinkKey key = new LinkKey(caller, callee);
|
||||
LinkStatistics statistics = linkStatisticsMap.get(key);
|
||||
if (statistics == null) {
|
||||
statistics = new LinkStatistics(caller, callee);
|
||||
linkStatisticsMap.put(key, statistics);
|
||||
}
|
||||
return statistics;
|
||||
}
|
||||
|
||||
private Application readCalleeApplication(byte[] qualifier) {
|
||||
String calleeApplicationName = ApplicationMapStatisticsUtils.getDestApplicationNameFromColumnName(qualifier);
|
||||
@@ -132,9 +124,9 @@ public class MapStatisticsCallerMapper implements RowMapper<Collection<LinkStati
|
||||
|
||||
|
||||
private Application readCalleeApplication(Buffer buffer) {
|
||||
short calleeServiceyType = buffer.readShort();
|
||||
short calleeServiceType = buffer.readShort();
|
||||
String calleeApplicationName = buffer.readPrefixedString();
|
||||
return new Application(calleeApplicationName, calleeServiceyType);
|
||||
return new Application(calleeApplicationName, calleeServiceType);
|
||||
}
|
||||
|
||||
private Application readCallerApplication(Buffer row) {
|
||||
|
||||
@@ -12,9 +12,9 @@ import java.util.Set;
|
||||
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.LinkStatisticsData;
|
||||
import com.nhn.pinpoint.web.util.TimeWindow;
|
||||
import com.nhn.pinpoint.web.util.TimeWindowOneMinuteSampler;
|
||||
import com.nhn.pinpoint.web.vo.LinkKey;
|
||||
import com.nhn.pinpoint.web.applicationmap.rawdata.LinkStatistics;
|
||||
import com.nhn.pinpoint.web.dao.*;
|
||||
import com.nhn.pinpoint.web.vo.*;
|
||||
@@ -195,8 +195,7 @@ public class FilteredMapServiceImpl implements FilteredMapService {
|
||||
// Window의 설정은 따로 inject받던지 해야 될듯함.
|
||||
final TimeWindow window = new TimeWindow(range, TimeWindowOneMinuteSampler.SAMPLER);
|
||||
|
||||
final Map<LinkKey, LinkStatistics> linkStatMap = new HashMap<LinkKey, LinkStatistics>();
|
||||
|
||||
final LinkStatisticsData linkStatisticsData = new LinkStatisticsData();
|
||||
final MapResponseHistogramSummary mapHistogramSummary = new MapResponseHistogramSummary(range);
|
||||
/**
|
||||
* 통계정보로 변환한다.
|
||||
@@ -216,32 +215,25 @@ public class FilteredMapServiceImpl implements FilteredMapService {
|
||||
continue;
|
||||
}
|
||||
|
||||
final LinkKey linkKey = new LinkKey(srcApplication, destApplication);
|
||||
LinkStatistics linkStat = linkStatMap.get(linkKey);
|
||||
if (linkStat == null) {
|
||||
linkStat = new LinkStatistics(srcApplication, destApplication);
|
||||
linkStatMap.put(linkKey, linkStat);
|
||||
}
|
||||
|
||||
final short slotTime = getHistogramSlotTime(span, destApplication.getServiceType());
|
||||
// link의 통계값에 collector acceptor time을 넣는것이 맞는것인지는 다시 생각해볼 필요가 있음.
|
||||
// 통계값의 window의 time으로 전환해야함. 안그러면 slot이 맞지 않아 oom이 발생할수 있음.
|
||||
long timestamp = window.refineTimestamp(span.getCollectorAcceptTime());
|
||||
linkStat.addCallData(span.getAgentId(), srcApplication.getServiceTypeCode(), destApplication.getName(), destApplication.getServiceTypeCode(), timestamp, slotTime, 1);
|
||||
|
||||
linkStatisticsData.addCallData(srcApplication, span.getAgentId(), destApplication, destApplication.getName(), timestamp, slotTime, 1);
|
||||
|
||||
|
||||
addNodeFromSpanEvent(span, window, linkStatMap, transactionSpanMap);
|
||||
addNodeFromSpanEvent(span, window, linkStatisticsData, transactionSpanMap);
|
||||
}
|
||||
}
|
||||
|
||||
// mark agent info
|
||||
for (LinkStatistics stat : linkStatMap.values()) {
|
||||
for (LinkStatistics stat : linkStatisticsData.getLinkStatData()) {
|
||||
fillAdditionalInfo(stat);
|
||||
}
|
||||
|
||||
Collection<LinkStatistics> linkStatisticsList = linkStatMap.values();
|
||||
ApplicationMapBuilder applicationMapBuilder = new ApplicationMapBuilder(range);
|
||||
ApplicationMap map = applicationMapBuilder.build(linkStatisticsList);
|
||||
ApplicationMap map = applicationMapBuilder.build(linkStatisticsData);
|
||||
|
||||
mapHistogramSummary.build();
|
||||
map.appendResponseTime(mapHistogramSummary);
|
||||
@@ -266,7 +258,7 @@ public class FilteredMapServiceImpl implements FilteredMapService {
|
||||
}
|
||||
|
||||
|
||||
private void addNodeFromSpanEvent(SpanBo span, TimeWindow window, Map<LinkKey, LinkStatistics> linkStatMap, Map<Long, SpanBo> transactionSpanMap) {
|
||||
private void addNodeFromSpanEvent(SpanBo span, TimeWindow window, LinkStatisticsData linkStatMap, Map<Long, SpanBo> transactionSpanMap) {
|
||||
/**
|
||||
* span event의 statistics추가.
|
||||
*/
|
||||
@@ -295,21 +287,13 @@ public class FilteredMapServiceImpl implements FilteredMapService {
|
||||
|
||||
final String dest = spanEvent.getDestinationId();
|
||||
final Application destApplication = new Application(dest, destServiceType);
|
||||
final LinkKey spanEventStatKey = new LinkKey(srcApplication, destApplication);
|
||||
LinkStatistics linkData = linkStatMap.get(spanEventStatKey);
|
||||
if (linkData == null) {
|
||||
linkData = new LinkStatistics(srcApplication, destApplication);
|
||||
// agent 정보추가. destination의 agent정보 알 수 없음.
|
||||
linkStatMap.put(spanEventStatKey, linkData);
|
||||
}
|
||||
|
||||
final short slotTime = getHistogramSlotTime(spanEvent, destServiceType);
|
||||
|
||||
// FIXME
|
||||
// stat2.addCallHistogram((dest == null) ? spanEvent.getEndPoint() : dest, destServiceType.getCode(), (short) slot2, 1);
|
||||
final long spanEventTimeStamp = window.refineTimestamp(span.getStartTime() + spanEvent.getStartElapsed());
|
||||
linkData.addCallData(span.getAgentId(), span.getServiceType().getCode(), spanEvent.getEndPoint(), destServiceType.getCode(), spanEventTimeStamp, slotTime, 1);
|
||||
|
||||
linkStatMap.addCallData(srcApplication, span.getAgentId(), destApplication, spanEvent.getEndPoint(), spanEventTimeStamp, slotTime, 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -366,7 +350,7 @@ public class FilteredMapServiceImpl implements FilteredMapService {
|
||||
return transactionIdList;
|
||||
}
|
||||
|
||||
private void fillAdditionalInfo(com.nhn.pinpoint.web.applicationmap.rawdata.LinkStatistics stat) {
|
||||
private void fillAdditionalInfo(LinkStatistics stat) {
|
||||
if (stat.getToServiceType().isTerminal() || stat.getToServiceType().isUnknown()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ package com.nhn.pinpoint.web.service;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import com.nhn.pinpoint.common.HistogramSchema;
|
||||
import com.nhn.pinpoint.web.applicationmap.ApplicationMapBuilder;
|
||||
import com.nhn.pinpoint.web.applicationmap.rawdata.*;
|
||||
import com.nhn.pinpoint.web.dao.*;
|
||||
@@ -70,25 +69,25 @@ public class MapServiceImpl implements MapService {
|
||||
* @param linkVisitChecker
|
||||
* @return
|
||||
*/
|
||||
private Set<LinkStatistics> selectCaller(Application callerApplication, Range range, LinkVisitChecker linkVisitChecker) {
|
||||
private LinkStatisticsData selectCaller(Application callerApplication, Range range, LinkVisitChecker linkVisitChecker) {
|
||||
// 이미 조회된 구간이면 skip
|
||||
if (linkVisitChecker.visitCaller(callerApplication)) {
|
||||
return Collections.emptySet();
|
||||
return new LinkStatisticsData();
|
||||
}
|
||||
|
||||
Collection<LinkStatistics> caller = mapStatisticsCallerDao.selectCaller(callerApplication, range);
|
||||
LinkStatisticsData caller = mapStatisticsCallerDao.selectCaller(callerApplication, range);
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Found Caller. count={}, caller={}", caller.size(), callerApplication);
|
||||
}
|
||||
|
||||
final Set<LinkStatistics> callerSet = new HashSet<LinkStatistics>();
|
||||
for (LinkStatistics stat : caller) {
|
||||
final LinkStatisticsData resultCaller = new LinkStatisticsData();
|
||||
for (LinkStatistics stat : caller.getLinkStatData()) {
|
||||
final boolean replaced = replaceApplicationInfo(stat, range);
|
||||
|
||||
// replaced된 녀석은 CLIENT이기 때문에 callee검색용도로만 사용하고 map에 추가하지 않는다.
|
||||
if (!replaced) {
|
||||
fillAdditionalInfo(stat, range);
|
||||
callerSet.add(stat);
|
||||
resultCaller.addLinkStatistics(stat);
|
||||
}
|
||||
|
||||
// terminal, unknowncloud 인 경우에는 skip
|
||||
@@ -97,21 +96,21 @@ public class MapServiceImpl implements MapService {
|
||||
}
|
||||
|
||||
logger.debug(" Find subCaller of {}", stat.getToApplication());
|
||||
Set<LinkStatistics> callerSub = selectCaller(stat.getToApplication(), range, linkVisitChecker);
|
||||
LinkStatisticsData callerSub = selectCaller(stat.getToApplication(), range, linkVisitChecker);
|
||||
logger.debug(" Found subCaller. count={}, caller={}", callerSub.size(), stat.getToApplication());
|
||||
|
||||
callerSet.addAll(callerSub);
|
||||
resultCaller.addLinkStatisticsData(callerSub);
|
||||
|
||||
// 찾아진 녀석들에 대한 caller도 찾는다.
|
||||
for (LinkStatistics eachCaller : callerSub) {
|
||||
for (LinkStatistics eachCaller : callerSub.getLinkStatData()) {
|
||||
logger.debug(" Find callee of {}", eachCaller.getFromApplication());
|
||||
Set<LinkStatistics> calleeSub = selectCallee(eachCaller.getFromApplication(), range, linkVisitChecker);
|
||||
LinkStatisticsData calleeSub = selectCallee(eachCaller.getFromApplication(), range, linkVisitChecker);
|
||||
logger.debug(" Found subCallee. count={}, callee={}", calleeSub.size(), eachCaller.getFromApplication());
|
||||
callerSet.addAll(calleeSub);
|
||||
resultCaller.addLinkStatisticsData(calleeSub);
|
||||
}
|
||||
}
|
||||
|
||||
return callerSet;
|
||||
return resultCaller;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -121,32 +120,32 @@ public class MapServiceImpl implements MapService {
|
||||
* @param range
|
||||
* @return
|
||||
*/
|
||||
private Set<LinkStatistics> selectCallee(Application calleeApplication, Range range, LinkVisitChecker linkVisitChecker) {
|
||||
private LinkStatisticsData selectCallee(Application calleeApplication, Range range, LinkVisitChecker linkVisitChecker) {
|
||||
// 이미 조회된 구간이면 skip
|
||||
if (linkVisitChecker.visitCallee(calleeApplication)) {
|
||||
return Collections.emptySet();
|
||||
return new LinkStatisticsData();
|
||||
}
|
||||
|
||||
final Collection<LinkStatistics> callee = mapStatisticsCalleeDao.selectCallee(calleeApplication, range);
|
||||
final LinkStatisticsData callee = mapStatisticsCalleeDao.selectCallee(calleeApplication, range);
|
||||
logger.debug("Found Callee. count={}, callee={}", callee.size(), calleeApplication);
|
||||
|
||||
final Set<LinkStatistics> calleeSet = new HashSet<LinkStatistics>();
|
||||
for (LinkStatistics stat : callee) {
|
||||
final LinkStatisticsData calleeSet = new LinkStatisticsData();
|
||||
for (LinkStatistics stat : callee.getLinkStatData()) {
|
||||
fillAdditionalInfo(stat, range);
|
||||
calleeSet.add(stat);
|
||||
calleeSet.addLinkStatistics(stat);
|
||||
|
||||
// 나를 부른 application을 찾아야 하기 떄문에 to를 입력.
|
||||
Set<LinkStatistics> calleeSub = selectCallee(stat.getFromApplication(), range, linkVisitChecker);
|
||||
calleeSet.addAll(calleeSub);
|
||||
LinkStatisticsData calleeSub = selectCallee(stat.getFromApplication(), range, linkVisitChecker);
|
||||
calleeSet.addLinkStatisticsData(calleeSub);
|
||||
|
||||
// 찾아진 녀석들에 대한 callee도 찾는다.
|
||||
for (LinkStatistics eachCallee : calleeSub) {
|
||||
for (LinkStatistics eachCallee : calleeSub.getLinkStatData()) {
|
||||
// terminal이면 skip
|
||||
if (eachCallee.getToServiceType().isTerminal() || eachCallee.getToServiceType().isUnknown()) {
|
||||
continue;
|
||||
}
|
||||
Set<LinkStatistics> callerSub = selectCaller(eachCallee.getToApplication(), range, linkVisitChecker);
|
||||
calleeSet.addAll(callerSub);
|
||||
LinkStatisticsData callerSub = selectCaller(eachCallee.getToApplication(), range, linkVisitChecker);
|
||||
calleeSet.addLinkStatisticsData(callerSub);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -204,15 +203,15 @@ public class MapServiceImpl implements MapService {
|
||||
watch.start();
|
||||
|
||||
LinkVisitChecker linkVisitChecker = new LinkVisitChecker();
|
||||
Set<LinkStatistics> caller = selectCaller(sourceApplication, range, linkVisitChecker);
|
||||
LinkStatisticsData caller = selectCaller(sourceApplication, range, linkVisitChecker);
|
||||
logger.debug("Result of finding caller {}", caller);
|
||||
|
||||
Set<LinkStatistics> callee = selectCallee(sourceApplication, range, linkVisitChecker);
|
||||
LinkStatisticsData callee = selectCallee(sourceApplication, range, linkVisitChecker);
|
||||
logger.debug("Result of finding callee {}", callee);
|
||||
|
||||
Set<LinkStatistics> data = new HashSet<LinkStatistics>(caller.size() + callee.size());
|
||||
data.addAll(caller);
|
||||
data.addAll(callee);
|
||||
LinkStatisticsData data = new LinkStatisticsData();
|
||||
data.addLinkStatisticsData(caller);
|
||||
data.addLinkStatisticsData(callee);
|
||||
|
||||
ApplicationMapBuilder builder = new ApplicationMapBuilder(range);
|
||||
ApplicationMap map = builder.build(data);
|
||||
@@ -235,17 +234,17 @@ public class MapServiceImpl implements MapService {
|
||||
throw new NullPointerException("destinationApplication must not be null");
|
||||
}
|
||||
|
||||
List<Collection<LinkStatistics>> list = selectLink(sourceApplication, destinationApplication, range);
|
||||
List<LinkStatisticsData> list = selectLink(sourceApplication, destinationApplication, range);
|
||||
logger.debug("Fetched statistics data={}", list);
|
||||
|
||||
MapResponseHistogramSummary responseHistogramSummary = new MapResponseHistogramSummary(range);
|
||||
for (Collection<LinkStatistics> linkStatisticsList : list) {
|
||||
for (LinkStatistics entry : linkStatisticsList) {
|
||||
CallHistogramList sourceList = entry.getSourceList();
|
||||
for (LinkStatisticsData entry : list) {
|
||||
for (LinkStatistics linkStatistics : entry.getLinkStatData()) {
|
||||
CallHistogramList sourceList = linkStatistics.getSourceList();
|
||||
Collection<CallHistogram> callHistogramList = sourceList.getCallHistogramList();
|
||||
for (CallHistogram histogram : callHistogramList) {
|
||||
for (TimeHistogram timeHistogram : histogram.getTimeHistogram()) {
|
||||
Application toApplication = entry.getToApplication();
|
||||
Application toApplication = linkStatistics.getToApplication();
|
||||
if (toApplication.getServiceType().isRpcClient()) {
|
||||
toApplication = new Application(toApplication.getName(), ServiceType.UNKNOWN);
|
||||
}
|
||||
@@ -260,7 +259,7 @@ public class MapServiceImpl implements MapService {
|
||||
return histogramSummary;
|
||||
}
|
||||
|
||||
private List<Collection<LinkStatistics>> selectLink(Application sourceApplication, Application destinationApplication, Range range) {
|
||||
private List<LinkStatisticsData> selectLink(Application sourceApplication, Application destinationApplication, Range range) {
|
||||
if (sourceApplication.getServiceType().isUser()) {
|
||||
logger.debug("Find 'client -> any' link statistics");
|
||||
// client는 applicatinname + servicetype.client로 기록된다.
|
||||
|
||||
Reference in New Issue
Block a user