Search in sources :

Example 6 with TransactionBo

use of com.navercorp.pinpoint.common.server.bo.stat.TransactionBo in project pinpoint by naver.

the class AgentStatMapper method map.

@Override
public AgentStatBo map(TAgentStat tAgentStat) {
    if (tAgentStat == null) {
        return null;
    }
    final String agentId = tAgentStat.getAgentId();
    final long startTimestamp = tAgentStat.getStartTimestamp();
    final long timestamp = tAgentStat.getTimestamp();
    AgentStatBo agentStatBo = new AgentStatBo();
    agentStatBo.setAgentId(agentId);
    // jvmGc
    if (tAgentStat.isSetGc()) {
        JvmGcBo jvmGcBo = this.jvmGcBoMapper.map(tAgentStat.getGc());
        setBaseData(jvmGcBo, agentId, startTimestamp, timestamp);
        agentStatBo.setJvmGcBos(Arrays.asList(jvmGcBo));
    }
    // jvmGcDetailed
    if (tAgentStat.isSetGc()) {
        if (tAgentStat.getGc().isSetJvmGcDetailed()) {
            JvmGcDetailedBo jvmGcDetailedBo = this.jvmGcDetailedBoMapper.map(tAgentStat.getGc().getJvmGcDetailed());
            setBaseData(jvmGcDetailedBo, agentId, startTimestamp, timestamp);
            agentStatBo.setJvmGcDetailedBos(Arrays.asList(jvmGcDetailedBo));
        }
    }
    // cpuLoad
    if (tAgentStat.isSetCpuLoad()) {
        CpuLoadBo cpuLoadBo = this.cpuLoadBoMapper.map(tAgentStat.getCpuLoad());
        setBaseData(cpuLoadBo, agentId, startTimestamp, timestamp);
        agentStatBo.setCpuLoadBos(Arrays.asList(cpuLoadBo));
    }
    // transaction
    if (tAgentStat.isSetTransaction()) {
        TransactionBo transactionBo = this.transactionBoMapper.map(tAgentStat.getTransaction());
        setBaseData(transactionBo, agentId, startTimestamp, timestamp);
        transactionBo.setCollectInterval(tAgentStat.getCollectInterval());
        agentStatBo.setTransactionBos(Arrays.asList(transactionBo));
    }
    // activeTrace
    if (tAgentStat.isSetActiveTrace() && tAgentStat.getActiveTrace().isSetHistogram()) {
        ActiveTraceBo activeTraceBo = this.activeTraceBoMapper.map(tAgentStat.getActiveTrace());
        setBaseData(activeTraceBo, agentId, startTimestamp, timestamp);
        agentStatBo.setActiveTraceBos(Arrays.asList(activeTraceBo));
    }
    // datasource
    if (tAgentStat.isSetDataSourceList()) {
        DataSourceListBo dataSourceListBo = new DataSourceListBo();
        setBaseData(dataSourceListBo, agentId, startTimestamp, timestamp);
        TDataSourceList dataSourceList = tAgentStat.getDataSourceList();
        for (TDataSource dataSource : dataSourceList.getDataSourceList()) {
            DataSourceBo dataSourceBo = dataSourceBoMapper.map(dataSource);
            setBaseData(dataSourceBo, agentId, startTimestamp, timestamp);
            dataSourceListBo.add(dataSourceBo);
        }
        agentStatBo.setDataSourceListBos(Arrays.asList(dataSourceListBo));
    }
    return agentStatBo;
}
Also used : JvmGcBo(com.navercorp.pinpoint.common.server.bo.stat.JvmGcBo) AgentStatBo(com.navercorp.pinpoint.common.server.bo.stat.AgentStatBo) CpuLoadBo(com.navercorp.pinpoint.common.server.bo.stat.CpuLoadBo) TDataSourceList(com.navercorp.pinpoint.thrift.dto.TDataSourceList) JvmGcDetailedBo(com.navercorp.pinpoint.common.server.bo.stat.JvmGcDetailedBo) DataSourceListBo(com.navercorp.pinpoint.common.server.bo.stat.DataSourceListBo) DataSourceBo(com.navercorp.pinpoint.common.server.bo.stat.DataSourceBo) TransactionBo(com.navercorp.pinpoint.common.server.bo.stat.TransactionBo) TDataSource(com.navercorp.pinpoint.thrift.dto.TDataSource) ActiveTraceBo(com.navercorp.pinpoint.common.server.bo.stat.ActiveTraceBo)

Example 7 with TransactionBo

use of com.navercorp.pinpoint.common.server.bo.stat.TransactionBo in project pinpoint by naver.

the class TransactionCodecV2 method encodeValues.

@Override
public void encodeValues(Buffer valueBuffer, List<TransactionBo> transactionBos) {
    if (CollectionUtils.isEmpty(transactionBos)) {
        throw new IllegalArgumentException("transactionBos must not be empty");
    }
    final int numValues = transactionBos.size();
    valueBuffer.putVInt(numValues);
    List<Long> startTimestamps = new ArrayList<Long>(numValues);
    List<Long> timestamps = new ArrayList<Long>(numValues);
    UnsignedLongEncodingStrategy.Analyzer.Builder collectIntervalAnalyzerBuilder = new UnsignedLongEncodingStrategy.Analyzer.Builder();
    UnsignedLongEncodingStrategy.Analyzer.Builder sampledNewCountAnalyzerBuilder = new UnsignedLongEncodingStrategy.Analyzer.Builder();
    UnsignedLongEncodingStrategy.Analyzer.Builder sampledContinuationCountAnalyzerBuilder = new UnsignedLongEncodingStrategy.Analyzer.Builder();
    UnsignedLongEncodingStrategy.Analyzer.Builder unsampledNewCountAnalyzerBuilder = new UnsignedLongEncodingStrategy.Analyzer.Builder();
    UnsignedLongEncodingStrategy.Analyzer.Builder unsampledContinuationCountAnalyzerBuilder = new UnsignedLongEncodingStrategy.Analyzer.Builder();
    for (TransactionBo transactionBo : transactionBos) {
        startTimestamps.add(transactionBo.getStartTimestamp());
        timestamps.add(transactionBo.getTimestamp());
        collectIntervalAnalyzerBuilder.addValue(transactionBo.getCollectInterval());
        sampledNewCountAnalyzerBuilder.addValue(transactionBo.getSampledNewCount());
        sampledContinuationCountAnalyzerBuilder.addValue(transactionBo.getSampledContinuationCount());
        unsampledNewCountAnalyzerBuilder.addValue(transactionBo.getUnsampledNewCount());
        unsampledContinuationCountAnalyzerBuilder.addValue(transactionBo.getUnsampledContinuationCount());
    }
    this.codec.encodeValues(valueBuffer, UnsignedLongEncodingStrategy.REPEAT_COUNT, startTimestamps);
    this.codec.encodeTimestamps(valueBuffer, timestamps);
    this.encodeDataPoints(valueBuffer, collectIntervalAnalyzerBuilder.build(), sampledNewCountAnalyzerBuilder.build(), sampledContinuationCountAnalyzerBuilder.build(), unsampledNewCountAnalyzerBuilder.build(), unsampledContinuationCountAnalyzerBuilder.build());
}
Also used : UnsignedLongEncodingStrategy(com.navercorp.pinpoint.common.server.bo.codec.stat.strategy.UnsignedLongEncodingStrategy) ArrayList(java.util.ArrayList) StrategyAnalyzer(com.navercorp.pinpoint.common.server.bo.codec.stat.strategy.StrategyAnalyzer) TransactionBo(com.navercorp.pinpoint.common.server.bo.stat.TransactionBo)

Example 8 with TransactionBo

use of com.navercorp.pinpoint.common.server.bo.stat.TransactionBo in project pinpoint by naver.

the class TransactionCodecV1 method decodeValues.

@Override
public List<TransactionBo> decodeValues(Buffer valueBuffer, AgentStatDecodingContext decodingContext) {
    final String agentId = decodingContext.getAgentId();
    final long baseTimestamp = decodingContext.getBaseTimestamp();
    final long timestampDelta = decodingContext.getTimestampDelta();
    final long initialTimestamp = baseTimestamp + timestampDelta;
    int numValues = valueBuffer.readVInt();
    List<Long> timestamps = this.codec.decodeTimestamps(initialTimestamp, valueBuffer, numValues);
    // decode headers
    final byte[] header = valueBuffer.readPrefixedBytes();
    AgentStatHeaderDecoder headerDecoder = new BitCountingHeaderDecoder(header);
    EncodingStrategy<Long> collectIntervalEncodingStrategy = UnsignedLongEncodingStrategy.getFromCode(headerDecoder.getCode());
    EncodingStrategy<Long> sampledNewCountEncodingStrategy = UnsignedLongEncodingStrategy.getFromCode(headerDecoder.getCode());
    EncodingStrategy<Long> sampledContinuationCountEncodingStrategy = UnsignedLongEncodingStrategy.getFromCode(headerDecoder.getCode());
    EncodingStrategy<Long> unsampledNewCountEncodingStrategy = UnsignedLongEncodingStrategy.getFromCode(headerDecoder.getCode());
    EncodingStrategy<Long> unsampledContinuationCountEncodingStrategy = UnsignedLongEncodingStrategy.getFromCode(headerDecoder.getCode());
    // decode values
    List<Long> collectIntervals = this.codec.decodeValues(valueBuffer, collectIntervalEncodingStrategy, numValues);
    List<Long> sampledNewCounts = this.codec.decodeValues(valueBuffer, sampledNewCountEncodingStrategy, numValues);
    List<Long> sampledContinuationCounts = this.codec.decodeValues(valueBuffer, sampledContinuationCountEncodingStrategy, numValues);
    List<Long> unsampledNewCounts = this.codec.decodeValues(valueBuffer, unsampledNewCountEncodingStrategy, numValues);
    List<Long> unsampledContinuationCounts = this.codec.decodeValues(valueBuffer, unsampledContinuationCountEncodingStrategy, numValues);
    List<TransactionBo> transactionBos = new ArrayList<TransactionBo>(numValues);
    for (int i = 0; i < numValues; ++i) {
        TransactionBo transactionBo = new TransactionBo();
        transactionBo.setAgentId(agentId);
        transactionBo.setTimestamp(timestamps.get(i));
        transactionBo.setCollectInterval(collectIntervals.get(i));
        transactionBo.setSampledNewCount(sampledNewCounts.get(i));
        transactionBo.setSampledContinuationCount(sampledContinuationCounts.get(i));
        transactionBo.setUnsampledNewCount(unsampledNewCounts.get(i));
        transactionBo.setUnsampledContinuationCount(unsampledContinuationCounts.get(i));
        transactionBos.add(transactionBo);
    }
    return transactionBos;
}
Also used : AgentStatHeaderDecoder(com.navercorp.pinpoint.common.server.bo.codec.stat.header.AgentStatHeaderDecoder) BitCountingHeaderDecoder(com.navercorp.pinpoint.common.server.bo.codec.stat.header.BitCountingHeaderDecoder) ArrayList(java.util.ArrayList) TransactionBo(com.navercorp.pinpoint.common.server.bo.stat.TransactionBo)

Example 9 with TransactionBo

use of com.navercorp.pinpoint.common.server.bo.stat.TransactionBo in project pinpoint by naver.

the class TestAgentStatFactory method createTransactionBos.

public static List<TransactionBo> createTransactionBos(String agentId, long startTimestamp, long initialTimestamp, int numValues) {
    List<TransactionBo> transactionBos = new ArrayList<TransactionBo>(numValues);
    List<Long> startTimestamps = createStartTimestamps(startTimestamp, numValues);
    List<Long> timestamps = createTimestamps(initialTimestamp, numValues);
    List<Long> collectIntervals = TestAgentStatDataPointFactory.LONG.createFluctuatingValues(100L, 10000L, 10L, 100L, numValues);
    List<Long> sampledNewCounts = TestAgentStatDataPointFactory.LONG.createFluctuatingValues(100L, 10000L, 10L, 100L, numValues);
    List<Long> sampledContinuationCounts = TestAgentStatDataPointFactory.LONG.createFluctuatingValues(100L, 10000L, 10L, 100L, numValues);
    List<Long> unsampledNewCount = TestAgentStatDataPointFactory.LONG.createFluctuatingValues(100L, 10000L, 10L, 100L, numValues);
    List<Long> unsampledContinuationCount = TestAgentStatDataPointFactory.LONG.createFluctuatingValues(100L, 10000L, 10L, 100L, numValues);
    for (int i = 0; i < numValues; ++i) {
        TransactionBo transactionBo = new TransactionBo();
        transactionBo.setAgentId(agentId);
        transactionBo.setStartTimestamp(startTimestamps.get(i));
        transactionBo.setTimestamp(timestamps.get(i));
        transactionBo.setCollectInterval(collectIntervals.get(i));
        transactionBo.setSampledNewCount(sampledNewCounts.get(i));
        transactionBo.setSampledContinuationCount(sampledContinuationCounts.get(i));
        transactionBo.setUnsampledNewCount(unsampledNewCount.get(i));
        transactionBo.setUnsampledContinuationCount(unsampledContinuationCount.get(i));
        transactionBos.add(transactionBo);
    }
    return transactionBos;
}
Also used : ArrayList(java.util.ArrayList) TransactionBo(com.navercorp.pinpoint.common.server.bo.stat.TransactionBo)

Example 10 with TransactionBo

use of com.navercorp.pinpoint.common.server.bo.stat.TransactionBo in project pinpoint by naver.

the class HbaseSampledTransactionDaoV2 method getSampledAgentStatList.

@Override
public List<SampledTransaction> getSampledAgentStatList(String agentId, TimeWindow timeWindow) {
    long scanFrom = timeWindow.getWindowRange().getFrom();
    long scanTo = timeWindow.getWindowRange().getTo() + timeWindow.getWindowSlotSize();
    Range range = new Range(scanFrom, scanTo);
    AgentStatMapperV2<TransactionBo> mapper = operations.createRowMapper(transactionDecoder, range);
    SampledAgentStatResultExtractor<TransactionBo, SampledTransaction> resultExtractor = new SampledAgentStatResultExtractor<>(timeWindow, mapper, transactionSampler);
    return operations.getSampledAgentStatList(AgentStatType.TRANSACTION, resultExtractor, agentId, range);
}
Also used : SampledTransaction(com.navercorp.pinpoint.web.vo.stat.SampledTransaction) SampledAgentStatResultExtractor(com.navercorp.pinpoint.web.mapper.stat.SampledAgentStatResultExtractor) Range(com.navercorp.pinpoint.web.vo.Range) 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