use of com.navercorp.pinpoint.common.server.bo.stat.EachUriStatBo in project pinpoint by naver.
the class GrpcAgentUriStatMapper method createEachUriStatBo.
private EachUriStatBo createEachUriStatBo(PEachUriStat pEachUriStat) {
EachUriStatBo eachUriStatBo = new EachUriStatBo();
final String uri = pEachUriStat.getUri();
eachUriStatBo.setUri(uri);
PUriHistogram pTotalHistogram = pEachUriStat.getTotalHistogram();
final UriStatHistogram totalHistogram = convertUriStatHistogram(pTotalHistogram);
eachUriStatBo.setTotalHistogram(totalHistogram);
PUriHistogram pFailedHistogram = pEachUriStat.getFailedHistogram();
final UriStatHistogram failedHistogram = convertUriStatHistogram(pFailedHistogram);
eachUriStatBo.setFailedHistogram(failedHistogram);
return eachUriStatBo;
}
use of com.navercorp.pinpoint.common.server.bo.stat.EachUriStatBo in project pinpoint by naver.
the class EachUriStatCodecV2 method encodeValues.
@Override
public void encodeValues(Buffer valueBuffer, List<EachUriStatBo> eachUriStatBoList) {
EachUriStatBoCodecEncoder eachUriStatBoCodecEncoder = new EachUriStatBoCodecEncoder(codec);
for (EachUriStatBo eachUriStatBo : eachUriStatBoList) {
eachUriStatBoCodecEncoder.addValue(eachUriStatBo);
}
eachUriStatBoCodecEncoder.encode(valueBuffer);
}
use of com.navercorp.pinpoint.common.server.bo.stat.EachUriStatBo in project pinpoint by naver.
the class SampledUriStatResultExtractor method divideByUri.
private Map<String, List<EachUriStatBo>> divideByUri(ResultScanner results) throws Exception {
Map<String, List<EachUriStatBo>> eachUriStatBoListMap = new HashMap<>();
int rowNum = 0;
for (Result result : results) {
for (AgentUriStatBo agentUriStatBo : this.rowMapper.mapRow(result, rowNum++)) {
List<EachUriStatBo> eachUriStatBoList = agentUriStatBo.getEachUriStatBoList();
if (CollectionUtils.isEmpty(eachUriStatBoList)) {
continue;
}
final String agentId = agentUriStatBo.getAgentId();
final long startTimestamp = agentUriStatBo.getStartTimestamp();
final long timestamp = agentUriStatBo.getTimestamp();
for (EachUriStatBo eachUriStatBo : eachUriStatBoList) {
String uri = eachUriStatBo.getUri();
List<EachUriStatBo> eachUriStatBos = eachUriStatBoListMap.computeIfAbsent(uri, k -> new ArrayList<>());
setAgentStatDataPointBaseData(eachUriStatBo, agentId, startTimestamp, timestamp);
eachUriStatBos.add(eachUriStatBo);
}
}
}
return eachUriStatBoListMap;
}
use of com.navercorp.pinpoint.common.server.bo.stat.EachUriStatBo 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.common.server.bo.stat.EachUriStatBo 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);
}
Aggregations