Search in sources :

Example 1 with SampledUriStatHistogramBo

use of com.navercorp.pinpoint.web.vo.stat.SampledUriStatHistogramBo 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)

Example 2 with SampledUriStatHistogramBo

use of com.navercorp.pinpoint.web.vo.stat.SampledUriStatHistogramBo in project pinpoint by naver.

the class AgentUriStatSampler method sampleDataPoints.

@Override
public SampledEachUriStatBo sampleDataPoints(int index, long timestamp, List<EachUriStatBo> eachUriStatBoList, EachUriStatBo previousDataPoint) {
    if (CollectionUtils.isEmpty(eachUriStatBoList)) {
        return null;
    }
    final String uri = getUri(eachUriStatBoList);
    List<UriStatHistogram> totalUriStatHistogramList = eachUriStatBoList.stream().map(EachUriStatBo::getTotalHistogram).filter(Objects::nonNull).collect(Collectors.toList());
    SampledUriStatHistogramBo sampledTotalUriStatHistogramBo = create(timestamp, totalUriStatHistogramList);
    List<UriStatHistogram> failedUriStatHistogramList = eachUriStatBoList.stream().map(EachUriStatBo::getFailedHistogram).filter(Objects::nonNull).collect(Collectors.toList());
    SampledUriStatHistogramBo failedSampledUriStatHistogramBo = create(timestamp, failedUriStatHistogramList);
    SampledEachUriStatBo sampledEachUriStatBo = new SampledEachUriStatBo(uri, sampledTotalUriStatHistogramBo, failedSampledUriStatHistogramBo);
    return sampledEachUriStatBo;
}
Also used : SampledEachUriStatBo(com.navercorp.pinpoint.web.vo.stat.SampledEachUriStatBo) SampledUriStatHistogramBo(com.navercorp.pinpoint.web.vo.stat.SampledUriStatHistogramBo) EachUriStatBo(com.navercorp.pinpoint.common.server.bo.stat.EachUriStatBo) SampledEachUriStatBo(com.navercorp.pinpoint.web.vo.stat.SampledEachUriStatBo) UriStatHistogram(com.navercorp.pinpoint.common.server.bo.stat.UriStatHistogram)

Example 3 with SampledUriStatHistogramBo

use of com.navercorp.pinpoint.web.vo.stat.SampledUriStatHistogramBo in project pinpoint by naver.

the class AgentUriStatSamplerTest method sampleTest.

@Test
public void sampleTest() {
    AgentUriStatSampler sampler = new AgentUriStatSampler();
    long currentTimeMillis = System.currentTimeMillis();
    long startTimestamp = currentTimeMillis - TimeUnit.DAYS.toMillis(30);
    List<EachUriStatBo> eachUriStatBoList = new ArrayList<>();
    eachUriStatBoList.add(createEachUriStatBo("agentId", startTimestamp, currentTimeMillis, "/index.html"));
    eachUriStatBoList.add(createEachUriStatBo("agentId", startTimestamp, currentTimeMillis, "/index.html"));
    SampledEachUriStatBo sampledEachUriStatBo = sampler.sampleDataPoints(0, System.currentTimeMillis(), eachUriStatBoList, null);
    SampledUriStatHistogramBo totalSampledUriStatHistogramBo = sampledEachUriStatBo.getTotalSampledUriStatHistogramBo();
    AgentStatPoint<Long> maxTimePoint = totalSampledUriStatHistogramBo.getMaxTimePoint();
    assertMaxValue(maxTimePoint, eachUriStatBoList);
    AgentStatPoint<Integer> countPoint = totalSampledUriStatHistogramBo.getCountPoint();
    assertCountValue(countPoint, eachUriStatBoList);
    int[] uriStatHistogramValue = totalSampledUriStatHistogramBo.getUriStatHistogramValue();
    assertHistogramValue(uriStatHistogramValue, eachUriStatBoList);
}
Also used : ArrayList(java.util.ArrayList) SampledEachUriStatBo(com.navercorp.pinpoint.web.vo.stat.SampledEachUriStatBo) SampledUriStatHistogramBo(com.navercorp.pinpoint.web.vo.stat.SampledUriStatHistogramBo) EachUriStatBo(com.navercorp.pinpoint.common.server.bo.stat.EachUriStatBo) SampledEachUriStatBo(com.navercorp.pinpoint.web.vo.stat.SampledEachUriStatBo) Test(org.junit.Test)

Example 4 with SampledUriStatHistogramBo

use of com.navercorp.pinpoint.web.vo.stat.SampledUriStatHistogramBo in project pinpoint by naver.

the class AgentUriStatSampler method createEmptySampledUriStatHistogramBo.

private SampledUriStatHistogramBo createEmptySampledUriStatHistogramBo(long timestamp) {
    AgentStatPoint<Integer> emptyIntegerPoint = AGENT_STAT_POINT_FACTORY.createIntPoint(timestamp, Collections.emptyList());
    AgentStatPoint<Long> emptyLongPoint = AGENT_STAT_POINT_FACTORY.createLongPoint(timestamp, Collections.emptyList());
    AgentStatPoint<Double> emptyDoublePoint = AGENT_STAT_POINT_FACTORY.createDoublePoint(timestamp, Collections.emptyList());
    SampledUriStatHistogramBo sampledUriStatHistogramBo = new SampledUriStatHistogramBo(emptyIntegerPoint, emptyLongPoint, emptyDoublePoint, EMPTY_URI_STAT_HISTOGRAM_MAP, 0L);
    return sampledUriStatHistogramBo;
}
Also used : SampledUriStatHistogramBo(com.navercorp.pinpoint.web.vo.stat.SampledUriStatHistogramBo)

Aggregations

SampledUriStatHistogramBo (com.navercorp.pinpoint.web.vo.stat.SampledUriStatHistogramBo)4 EachUriStatBo (com.navercorp.pinpoint.common.server.bo.stat.EachUriStatBo)2 SampledEachUriStatBo (com.navercorp.pinpoint.web.vo.stat.SampledEachUriStatBo)2 UriStatHistogram (com.navercorp.pinpoint.common.server.bo.stat.UriStatHistogram)1 UriStatHistogramBucket (com.navercorp.pinpoint.common.trace.UriStatHistogramBucket)1 AgentStatPoint (com.navercorp.pinpoint.web.vo.stat.chart.agent.AgentStatPoint)1 ArrayList (java.util.ArrayList)1 Test (org.junit.Test)1