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