use of com.navercorp.pinpoint.common.server.bo.codec.stat.header.BitCountingHeaderDecoder 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;
}
Aggregations