Search in sources :

Example 1 with AgentStatPoint

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;
}
Also used : SampledUriStatHistogramBo(com.navercorp.pinpoint.web.vo.stat.SampledUriStatHistogramBo) UriStatHistogramBucket(com.navercorp.pinpoint.common.trace.UriStatHistogramBucket) AgentStatPoint(com.navercorp.pinpoint.web.vo.stat.chart.agent.AgentStatPoint)

Aggregations

UriStatHistogramBucket (com.navercorp.pinpoint.common.trace.UriStatHistogramBucket)1 SampledUriStatHistogramBo (com.navercorp.pinpoint.web.vo.stat.SampledUriStatHistogramBo)1 AgentStatPoint (com.navercorp.pinpoint.web.vo.stat.chart.agent.AgentStatPoint)1