Search in sources :

Example 1 with SampledEachUriStatBo

use of com.navercorp.pinpoint.web.vo.stat.SampledEachUriStatBo 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 2 with SampledEachUriStatBo

use of com.navercorp.pinpoint.web.vo.stat.SampledEachUriStatBo 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 3 with SampledEachUriStatBo

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

the class SampledUriStatResultExtractor method getSampleData.

private SampledAgentUriStat getSampleData(List<EachUriStatBo> eachUriStatBos) {
    eachUriStatBos.sort(Comparator.comparingLong(EachUriStatBo::getTimestamp).reversed());
    AgentStatSamplingHandler<EachUriStatBo, SampledEachUriStatBo> samplingHandler = new EagerSamplingHandler<>(timeWindow, sampler);
    for (EachUriStatBo eachUriStatBo : eachUriStatBos) {
        samplingHandler.addDataPoint(eachUriStatBo);
    }
    List<SampledEachUriStatBo> sampledDataPoints = samplingHandler.getSampledDataPoints();
    SampledAgentUriStat sampledAgentUriStat = new SampledAgentUriStat(sampledDataPoints);
    return sampledAgentUriStat;
}
Also used : SampledEachUriStatBo(com.navercorp.pinpoint.web.vo.stat.SampledEachUriStatBo) EachUriStatBo(com.navercorp.pinpoint.common.server.bo.stat.EachUriStatBo) SampledEachUriStatBo(com.navercorp.pinpoint.web.vo.stat.SampledEachUriStatBo) EagerSamplingHandler(com.navercorp.pinpoint.web.mapper.stat.sampling.EagerSamplingHandler) SampledAgentUriStat(com.navercorp.pinpoint.web.vo.stat.SampledAgentUriStat)

Aggregations

EachUriStatBo (com.navercorp.pinpoint.common.server.bo.stat.EachUriStatBo)3 SampledEachUriStatBo (com.navercorp.pinpoint.web.vo.stat.SampledEachUriStatBo)3 SampledUriStatHistogramBo (com.navercorp.pinpoint.web.vo.stat.SampledUriStatHistogramBo)2 UriStatHistogram (com.navercorp.pinpoint.common.server.bo.stat.UriStatHistogram)1 EagerSamplingHandler (com.navercorp.pinpoint.web.mapper.stat.sampling.EagerSamplingHandler)1 SampledAgentUriStat (com.navercorp.pinpoint.web.vo.stat.SampledAgentUriStat)1 ArrayList (java.util.ArrayList)1 Test (org.junit.Test)1