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