forked from pinpoint-apm/pinpoint
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[pinpoint-apm#9945] add time aggregation to new servermap api
- Loading branch information
1 parent
ba2b3b1
commit c5a3ca1
Showing
42 changed files
with
601 additions
and
136 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
111 changes: 111 additions & 0 deletions
111
...ercorp/pinpoint/web/applicationmap/appender/histogram/SimplifiedNodeHistogramFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
package com.navercorp.pinpoint.web.applicationmap.appender.histogram; | ||
|
||
import com.navercorp.pinpoint.common.server.util.time.Range; | ||
import com.navercorp.pinpoint.web.applicationmap.appender.histogram.datasource.WasNodeHistogramDataSource; | ||
import com.navercorp.pinpoint.web.applicationmap.histogram.Histogram; | ||
import com.navercorp.pinpoint.web.applicationmap.histogram.NodeHistogram; | ||
import com.navercorp.pinpoint.web.applicationmap.link.Link; | ||
import com.navercorp.pinpoint.web.applicationmap.link.LinkList; | ||
import com.navercorp.pinpoint.web.applicationmap.rawdata.AgentHistogram; | ||
import com.navercorp.pinpoint.web.applicationmap.rawdata.AgentHistogramList; | ||
import com.navercorp.pinpoint.web.applicationmap.rawdata.LinkCallDataMap; | ||
import com.navercorp.pinpoint.web.vo.Application; | ||
import org.apache.logging.log4j.LogManager; | ||
import org.apache.logging.log4j.Logger; | ||
|
||
import java.util.HashMap; | ||
import java.util.List; | ||
import java.util.Map; | ||
import java.util.Objects; | ||
|
||
public class SimplifiedNodeHistogramFactory implements NodeHistogramFactory { | ||
|
||
private final Logger logger = LogManager.getLogger(this.getClass()); | ||
|
||
private final WasNodeHistogramDataSource wasNodeHistogramDataSource; | ||
|
||
public SimplifiedNodeHistogramFactory(WasNodeHistogramDataSource wasNodeHistogramDataSource) { | ||
this.wasNodeHistogramDataSource = Objects.requireNonNull(wasNodeHistogramDataSource, "wasNodeHistogramDataSource"); | ||
} | ||
|
||
@Override | ||
public NodeHistogram createWasNodeHistogram(Application wasApplication, Range range) { | ||
return wasNodeHistogramDataSource.createNodeHistogram(wasApplication, range); | ||
} | ||
|
||
@Override | ||
public NodeHistogram createTerminalNodeHistogram(Application terminalApplication, Range range, LinkList linkList) { | ||
// for Terminal nodes, add all links pointing to the application and create the histogram | ||
final NodeHistogram nodeHistogram = new NodeHistogram(terminalApplication, range); | ||
|
||
// create applicationHistogram | ||
final List<Link> toLinkList = linkList.findToLink(terminalApplication); | ||
final Histogram applicationHistogram = new Histogram(terminalApplication.getServiceType()); | ||
for (Link link : toLinkList) { | ||
applicationHistogram.add(link.getHistogram()); | ||
} | ||
nodeHistogram.setApplicationHistogram(applicationHistogram); | ||
|
||
// create Agent histogram map for StatisticsAgentState | ||
if (terminalApplication.getServiceType().isTerminal() || terminalApplication.getServiceType().isAlias()) { | ||
final Map<String, Histogram> agentHistogramMap = new HashMap<>(); | ||
for (Link link : toLinkList) { | ||
LinkCallDataMap sourceLinkCallDataMap = link.getSourceLinkCallDataMap(); | ||
AgentHistogramList targetList = sourceLinkCallDataMap.getTargetList(); | ||
for (AgentHistogram histogram : targetList.getAgentHistogramList()) { | ||
Histogram find = agentHistogramMap.get(histogram.getId()); | ||
if (find == null) { | ||
find = new Histogram(histogram.getServiceType()); | ||
agentHistogramMap.put(histogram.getId(), find); | ||
} | ||
find.add(histogram.getHistogram()); | ||
} | ||
nodeHistogram.setAgentHistogramMap(agentHistogramMap); | ||
} | ||
} | ||
|
||
return nodeHistogram; | ||
} | ||
|
||
@Override | ||
public NodeHistogram createUserNodeHistogram(Application userApplication, Range range, LinkList linkList) { | ||
// for User nodes, find its source link and create the histogram | ||
final NodeHistogram nodeHistogram = new NodeHistogram(userApplication, range); | ||
final List<Link> fromLink = linkList.findFromLink(userApplication); | ||
if (fromLink.isEmpty()) { | ||
logger.warn("from UserNode not found:{}", userApplication); | ||
return createEmptyNodeHistogram(userApplication, range); | ||
} else if (fromLink.size() > 1) { | ||
// log and use first(0) link. | ||
logger.warn("Invalid from UserNode:{}", linkList.getLinkList()); | ||
} | ||
final Link sourceLink = fromLink.get(0); | ||
nodeHistogram.setApplicationHistogram(sourceLink.getHistogram()); | ||
|
||
return nodeHistogram; | ||
} | ||
|
||
@Override | ||
public NodeHistogram createQueueNodeHistogram(Application queueApplication, Range range, LinkList linkList) { | ||
final List<Link> toLinkList = linkList.findToLink(queueApplication); | ||
if (toLinkList.isEmpty()) { | ||
return new NodeHistogram(queueApplication, range); | ||
} | ||
|
||
final NodeHistogram nodeHistogram = new NodeHistogram(queueApplication, range); | ||
|
||
// create applicationHistogram | ||
final Histogram applicationHistogram = new Histogram(queueApplication.getServiceType()); | ||
for (Link link : toLinkList) { | ||
applicationHistogram.add(link.getHistogram()); | ||
} | ||
nodeHistogram.setApplicationHistogram(applicationHistogram); | ||
|
||
return nodeHistogram; | ||
} | ||
|
||
@Override | ||
public NodeHistogram createEmptyNodeHistogram(Application application, Range range) { | ||
return new NodeHistogram(application, range); | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
...cationmap/appender/histogram/datasource/MapResponseSimplifiedNodeHistogramDataSource.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
|
||
package com.navercorp.pinpoint.web.applicationmap.appender.histogram.datasource; | ||
|
||
import com.navercorp.pinpoint.common.server.util.time.Range; | ||
import com.navercorp.pinpoint.web.applicationmap.histogram.NodeHistogram; | ||
import com.navercorp.pinpoint.web.dao.MapResponseDao; | ||
import com.navercorp.pinpoint.web.vo.Application; | ||
import com.navercorp.pinpoint.web.vo.ResponseTime; | ||
|
||
import java.util.List; | ||
import java.util.Objects; | ||
|
||
public class MapResponseSimplifiedNodeHistogramDataSource implements WasNodeHistogramDataSource { | ||
|
||
private final MapResponseDao mapResponseDao; | ||
|
||
public MapResponseSimplifiedNodeHistogramDataSource(MapResponseDao mapResponseDao) { | ||
this.mapResponseDao = Objects.requireNonNull(mapResponseDao, "mapResponseDao"); | ||
} | ||
|
||
@Override | ||
public NodeHistogram createNodeHistogram(Application application, Range range) { | ||
List<ResponseTime> responseTimes = mapResponseDao.selectResponseTime(application, range); | ||
final NodeHistogram nodeHistogram = new NodeHistogram(application, range); | ||
nodeHistogram.setApplicationHistogram(responseTimes); | ||
nodeHistogram.setAgentHistogramMap(responseTimes); | ||
return nodeHistogram; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,7 @@ | |
* @author HyunGil Jeong | ||
*/ | ||
public enum LinkType { | ||
SIMPLIFIED, | ||
BASIC, | ||
DETAILED | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,7 @@ | |
* @author HyunGil Jeong | ||
*/ | ||
public enum NodeType { | ||
SIMPLIFIED, | ||
BASIC, | ||
DETAILED | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.