use of com.navercorp.pinpoint.web.vo.stat.chart.agent.AgentStatPoint in project pinpoint by naver.
the class AgentUriStatSampler method create.
private SampledUriStatHistogramBo create(long timestamp, List<UriStatHistogram> uriStatHistogramList) {
if (CollectionUtils.isEmpty(uriStatHistogramList)) {
return createEmptySampledUriStatHistogramBo(timestamp);
}
final List<Integer> countList = uriStatHistogramList.stream().map(UriStatHistogram::getCount).collect(Collectors.toList());
final AgentStatPoint<Integer> countPoint = AGENT_STAT_POINT_FACTORY.createIntPoint(timestamp, countList);
final List<Long> maxElapsedTimeList = uriStatHistogramList.stream().map(UriStatHistogram::getMax).collect(Collectors.toList());
final AgentStatPoint<Long> maxElapsedTimePoint = AGENT_STAT_POINT_FACTORY.createLongPoint(timestamp, maxElapsedTimeList);
final List<Double> avgElapsedTimeList = uriStatHistogramList.stream().map(UriStatHistogram::getAvg).collect(Collectors.toList());
final AgentStatPoint<Double> avgElapsedTimePoint = AGENT_STAT_POINT_FACTORY.createDoublePoint(timestamp, avgElapsedTimeList, 3);
final Map<UriStatHistogramBucket, Integer> uriStatHistogramCountMap = createHistogramBucketCountMap(uriStatHistogramList);
long totalElapsedTime = 0;
for (int i = 0; i < countList.size(); i++) {
totalElapsedTime += (countList.get(i) * avgElapsedTimeList.get(i));
}
SampledUriStatHistogramBo sampledUriStatHistogramBo = new SampledUriStatHistogramBo(countPoint, maxElapsedTimePoint, avgElapsedTimePoint, uriStatHistogramCountMap, totalElapsedTime);
return sampledUriStatHistogramBo;
}
Aggregations