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;
}
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);
}
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;
}
Aggregations