Search in sources :

Example 11 with TransactionBo

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;
}
Also used : SampledTransaction(com.navercorp.pinpoint.web.vo.stat.SampledTransaction) ArrayList(java.util.ArrayList) TransactionBo(com.navercorp.pinpoint.common.server.bo.stat.TransactionBo)

Aggregations

TransactionBo (com.navercorp.pinpoint.common.server.bo.stat.TransactionBo)11 ArrayList (java.util.ArrayList)7 SampledTransaction (com.navercorp.pinpoint.web.vo.stat.SampledTransaction)3 AgentStatHeaderDecoder (com.navercorp.pinpoint.common.server.bo.codec.stat.header.AgentStatHeaderDecoder)2 BitCountingHeaderDecoder (com.navercorp.pinpoint.common.server.bo.codec.stat.header.BitCountingHeaderDecoder)2 StrategyAnalyzer (com.navercorp.pinpoint.common.server.bo.codec.stat.strategy.StrategyAnalyzer)2 UnsignedLongEncodingStrategy (com.navercorp.pinpoint.common.server.bo.codec.stat.strategy.UnsignedLongEncodingStrategy)2 ActiveTraceBo (com.navercorp.pinpoint.common.server.bo.stat.ActiveTraceBo)2 AgentStatBo (com.navercorp.pinpoint.common.server.bo.stat.AgentStatBo)2 CpuLoadBo (com.navercorp.pinpoint.common.server.bo.stat.CpuLoadBo)2 DataSourceBo (com.navercorp.pinpoint.common.server.bo.stat.DataSourceBo)2 DataSourceListBo (com.navercorp.pinpoint.common.server.bo.stat.DataSourceListBo)2 JvmGcBo (com.navercorp.pinpoint.common.server.bo.stat.JvmGcBo)2 JvmGcDetailedBo (com.navercorp.pinpoint.common.server.bo.stat.JvmGcDetailedBo)2 TDataSource (com.navercorp.pinpoint.thrift.dto.TDataSource)2 TDataSourceList (com.navercorp.pinpoint.thrift.dto.TDataSourceList)2 SampledAgentStatResultExtractor (com.navercorp.pinpoint.web.mapper.stat.SampledAgentStatResultExtractor)2 Range (com.navercorp.pinpoint.web.vo.Range)2 TAgentStat (com.navercorp.pinpoint.thrift.dto.TAgentStat)1