use of com.navercorp.pinpoint.common.server.bo.codec.stat.header.BitCountingHeaderDecoder in project pinpoint by naver.
the class ActiveTraceCodecV1 method decodeValues.
@Override
public List<ActiveTraceBo> 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<Short> versionEncodingStrategy = UnsignedShortEncodingStrategy.getFromCode(headerDecoder.getCode());
EncodingStrategy<Integer> schemaTypeEncodingStrategy = UnsignedIntegerEncodingStrategy.getFromCode(headerDecoder.getCode());
EncodingStrategy<Integer> fastTraceCountsEncodingStrategy = UnsignedIntegerEncodingStrategy.getFromCode(headerDecoder.getCode());
EncodingStrategy<Integer> normalTraceCountsEncodingStrategy = UnsignedIntegerEncodingStrategy.getFromCode(headerDecoder.getCode());
EncodingStrategy<Integer> slowTraceCountsEncodingStrategy = UnsignedIntegerEncodingStrategy.getFromCode(headerDecoder.getCode());
EncodingStrategy<Integer> verySlowTraceCountsEncodingStrategy = UnsignedIntegerEncodingStrategy.getFromCode(headerDecoder.getCode());
// decode values
List<Short> versions = this.codec.decodeValues(valueBuffer, versionEncodingStrategy, numValues);
List<Integer> schemaTypes = this.codec.decodeValues(valueBuffer, schemaTypeEncodingStrategy, numValues);
List<Integer> fastTraceCounts = this.codec.decodeValues(valueBuffer, fastTraceCountsEncodingStrategy, numValues);
List<Integer> normalTraceCounts = this.codec.decodeValues(valueBuffer, normalTraceCountsEncodingStrategy, numValues);
List<Integer> slowTraceCounts = this.codec.decodeValues(valueBuffer, slowTraceCountsEncodingStrategy, numValues);
List<Integer> verySlowTraceCounts = this.codec.decodeValues(valueBuffer, verySlowTraceCountsEncodingStrategy, numValues);
List<ActiveTraceBo> activeTraceBos = new ArrayList<ActiveTraceBo>(numValues);
for (int i = 0; i < numValues; ++i) {
ActiveTraceBo activeTraceBo = new ActiveTraceBo();
activeTraceBo.setAgentId(agentId);
activeTraceBo.setTimestamp(timestamps.get(i));
activeTraceBo.setVersion(versions.get(i));
activeTraceBo.setHistogramSchemaType(schemaTypes.get(i));
Map<SlotType, Integer> activeTraceCounts = new HashMap<SlotType, Integer>();
activeTraceCounts.put(SlotType.FAST, fastTraceCounts.get(i));
activeTraceCounts.put(SlotType.NORMAL, normalTraceCounts.get(i));
activeTraceCounts.put(SlotType.SLOW, slowTraceCounts.get(i));
activeTraceCounts.put(SlotType.VERY_SLOW, verySlowTraceCounts.get(i));
activeTraceBo.setActiveTraceCounts(activeTraceCounts);
activeTraceBos.add(activeTraceBo);
}
return activeTraceBos;
}
use of com.navercorp.pinpoint.common.server.bo.codec.stat.header.BitCountingHeaderDecoder in project pinpoint by naver.
the class CpuLoadCodecV1 method decodeValues.
@Override
public List<CpuLoadBo> 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> jvmCpuLoadEncodingStrategy = UnsignedLongEncodingStrategy.getFromCode(headerDecoder.getCode());
EncodingStrategy<Long> systemCpuLoadEncodingStrategy = UnsignedLongEncodingStrategy.getFromCode(headerDecoder.getCode());
// decode values
List<Long> jvmCpuLoads = this.codec.decodeValues(valueBuffer, jvmCpuLoadEncodingStrategy, numValues);
List<Long> systemCpuLoads = this.codec.decodeValues(valueBuffer, systemCpuLoadEncodingStrategy, numValues);
List<CpuLoadBo> cpuLoadBos = new ArrayList<CpuLoadBo>(numValues);
for (int i = 0; i < numValues; ++i) {
CpuLoadBo cpuLoadBo = new CpuLoadBo();
cpuLoadBo.setAgentId(agentId);
cpuLoadBo.setTimestamp(timestamps.get(i));
cpuLoadBo.setJvmCpuLoad(AgentStatUtils.convertLongToDouble(jvmCpuLoads.get(i)));
cpuLoadBo.setSystemCpuLoad(AgentStatUtils.convertLongToDouble(systemCpuLoads.get(i)));
cpuLoadBos.add(cpuLoadBo);
}
return cpuLoadBos;
}
use of com.navercorp.pinpoint.common.server.bo.codec.stat.header.BitCountingHeaderDecoder in project pinpoint by naver.
the class TransactionCodecV2 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> startTimestamps = this.codec.decodeValues(valueBuffer, UnsignedLongEncodingStrategy.REPEAT_COUNT, numValues);
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.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(unsampledNewCounts.get(i));
transactionBo.setUnsampledContinuationCount(unsampledContinuationCounts.get(i));
transactionBos.add(transactionBo);
}
return transactionBos;
}
use of com.navercorp.pinpoint.common.server.bo.codec.stat.header.BitCountingHeaderDecoder in project pinpoint by naver.
the class DataSourceCodec method decodeJoinDataSourceBoList.
private List<JoinDataSourceBo> decodeJoinDataSourceBoList(Buffer valueBuffer) {
int numValues = valueBuffer.readVInt();
final byte[] header = valueBuffer.readPrefixedBytes();
AgentStatHeaderDecoder headerDecoder = new BitCountingHeaderDecoder(header);
EncodingStrategy<Short> serviceTypeEncodingStrategy = UnsignedShortEncodingStrategy.getFromCode(headerDecoder.getCode());
EncodingStrategy<String> urlEncodingStrategy = StringEncodingStrategy.getFromCode(headerDecoder.getCode());
JoinIntFieldEncodingStrategy activeConnectionSizeEncodingStrategy = JoinIntFieldEncodingStrategy.getFromCode(headerDecoder.getCode(), headerDecoder.getCode(), headerDecoder.getCode(), headerDecoder.getCode(), headerDecoder.getCode());
List<Short> serviceTypeCodeList = this.codec.decodeValues(valueBuffer, serviceTypeEncodingStrategy, numValues);
List<String> jdbcUrlList = this.codec.decodeValues(valueBuffer, urlEncodingStrategy, numValues);
final List<JoinIntFieldBo> activeConnectionSizeValueList = this.codec.decodeValues(valueBuffer, activeConnectionSizeEncodingStrategy, numValues);
List<JoinDataSourceBo> joinDataSourceBoList = new ArrayList<JoinDataSourceBo>(numValues);
for (int i = 0; i < numValues; ++i) {
JoinDataSourceBo joinDataSourceBo = new JoinDataSourceBo();
joinDataSourceBo.setServiceTypeCode(serviceTypeCodeList.get(i));
joinDataSourceBo.setUrl(jdbcUrlList.get(i));
joinDataSourceBo.setActiveConnectionSizeJoinValue(activeConnectionSizeValueList.get(i));
joinDataSourceBoList.add(joinDataSourceBo);
}
return joinDataSourceBoList;
}
use of com.navercorp.pinpoint.common.server.bo.codec.stat.header.BitCountingHeaderDecoder in project pinpoint by naver.
the class MemoryCodec method decodeValues.
@Override
public List<JoinStatBo> decodeValues(Buffer valueBuffer, ApplicationStatDecodingContext decodingContext) {
final String id = decodingContext.getApplicationId();
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);
JoinLongFieldEncodingStrategy heapUsedEncodingStrategy = JoinLongFieldEncodingStrategy.getFromCode(headerDecoder.getCode(), headerDecoder.getCode(), headerDecoder.getCode(), headerDecoder.getCode(), headerDecoder.getCode());
JoinLongFieldEncodingStrategy nonHeapUsedEncodingStrategy = JoinLongFieldEncodingStrategy.getFromCode(headerDecoder.getCode(), headerDecoder.getCode(), headerDecoder.getCode(), headerDecoder.getCode(), headerDecoder.getCode());
// decode values
final List<JoinLongFieldBo> heapUsedList = this.codec.decodeValues(valueBuffer, heapUsedEncodingStrategy, numValues);
final List<JoinLongFieldBo> nonHeapUsedList = this.codec.decodeValues(valueBuffer, nonHeapUsedEncodingStrategy, numValues);
List<JoinStatBo> joinMemoryBoList = new ArrayList<>(numValues);
for (int i = 0; i < numValues; i++) {
JoinMemoryBo joinMemoryBo = new JoinMemoryBo();
joinMemoryBo.setId(id);
joinMemoryBo.setTimestamp(timestamps.get(i));
joinMemoryBo.setHeapUsedJoinValue(heapUsedList.get(i));
joinMemoryBo.setNonHeapUsedJoinValue(nonHeapUsedList.get(i));
joinMemoryBoList.add(joinMemoryBo);
}
return joinMemoryBoList;
}
Aggregations