use of com.navercorp.pinpoint.common.server.bo.stat.TransactionBo in project pinpoint by naver.
the class TransactionSampler method sampleDataPoints.
@Override
public SampledTransaction sampleDataPoints(int timeWindowIndex, long timestamp, List<TransactionBo> dataPoints, TransactionBo previousDataPoint) {
List<Double> sampledNews = new ArrayList<>(dataPoints.size());
List<Double> sampledContinuations = new ArrayList<>(dataPoints.size());
List<Double> unsampledNews = new ArrayList<>(dataPoints.size());
List<Double> unsampledContinuations = new ArrayList<>(dataPoints.size());
List<Double> totals = new ArrayList<>(dataPoints.size());
for (TransactionBo transactionBo : dataPoints) {
long collectInterval = transactionBo.getCollectInterval();
if (collectInterval > 0) {
boolean isTransactionCollected = false;
long totalCount = 0;
if (transactionBo.getSampledNewCount() != TransactionBo.UNCOLLECTED_VALUE) {
isTransactionCollected = true;
long sampledNewCount = transactionBo.getSampledNewCount();
sampledNews.add(calculateTps(sampledNewCount, collectInterval));
totalCount += sampledNewCount;
}
if (transactionBo.getSampledContinuationCount() != TransactionBo.UNCOLLECTED_VALUE) {
isTransactionCollected = true;
long sampledContinuationCount = transactionBo.getSampledContinuationCount();
sampledContinuations.add(calculateTps(sampledContinuationCount, collectInterval));
totalCount += sampledContinuationCount;
}
if (transactionBo.getUnsampledNewCount() != TransactionBo.UNCOLLECTED_VALUE) {
isTransactionCollected = true;
long unsampledNewCount = transactionBo.getUnsampledNewCount();
unsampledNews.add(calculateTps(unsampledNewCount, collectInterval));
totalCount += unsampledNewCount;
}
if (transactionBo.getUnsampledContinuationCount() != TransactionBo.UNCOLLECTED_VALUE) {
isTransactionCollected = true;
long unsampledContinuationCount = transactionBo.getUnsampledContinuationCount();
unsampledContinuations.add(calculateTps(unsampledContinuationCount, collectInterval));
totalCount += unsampledContinuationCount;
}
if (isTransactionCollected) {
totals.add(calculateTps(totalCount, collectInterval));
}
}
}
SampledTransaction sampledTransaction = new SampledTransaction();
sampledTransaction.setSampledNew(createPoint(timestamp, sampledNews));
sampledTransaction.setSampledContinuation(createPoint(timestamp, sampledContinuations));
sampledTransaction.setUnsampledNew(createPoint(timestamp, unsampledNews));
sampledTransaction.setUnsampledContinuation(createPoint(timestamp, unsampledContinuations));
sampledTransaction.setTotal(createPoint(timestamp, totals));
return sampledTransaction;
}
Aggregations