Search in sources :

Example 1 with AgentStatHeaderDecoder

use of com.navercorp.pinpoint.common.server.bo.codec.stat.header.AgentStatHeaderDecoder 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;
}
Also used : HashMap(java.util.HashMap) BitCountingHeaderDecoder(com.navercorp.pinpoint.common.server.bo.codec.stat.header.BitCountingHeaderDecoder) ArrayList(java.util.ArrayList) SlotType(com.navercorp.pinpoint.common.trace.SlotType) AgentStatHeaderDecoder(com.navercorp.pinpoint.common.server.bo.codec.stat.header.AgentStatHeaderDecoder) ActiveTraceBo(com.navercorp.pinpoint.common.server.bo.stat.ActiveTraceBo)

Example 2 with AgentStatHeaderDecoder

use of com.navercorp.pinpoint.common.server.bo.codec.stat.header.AgentStatHeaderDecoder 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;
}
Also used : AgentStatHeaderDecoder(com.navercorp.pinpoint.common.server.bo.codec.stat.header.AgentStatHeaderDecoder) CpuLoadBo(com.navercorp.pinpoint.common.server.bo.stat.CpuLoadBo) BitCountingHeaderDecoder(com.navercorp.pinpoint.common.server.bo.codec.stat.header.BitCountingHeaderDecoder) ArrayList(java.util.ArrayList)

Example 3 with AgentStatHeaderDecoder

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

use of com.navercorp.pinpoint.common.server.bo.codec.stat.header.AgentStatHeaderDecoder 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;
}
Also used : BitCountingHeaderDecoder(com.navercorp.pinpoint.common.server.bo.codec.stat.header.BitCountingHeaderDecoder) ArrayList(java.util.ArrayList) AgentStatHeaderDecoder(com.navercorp.pinpoint.common.server.bo.codec.stat.header.AgentStatHeaderDecoder) JoinIntFieldBo(com.navercorp.pinpoint.common.server.bo.stat.join.JoinIntFieldBo) JoinDataSourceBo(com.navercorp.pinpoint.common.server.bo.stat.join.JoinDataSourceBo) JoinIntFieldEncodingStrategy(com.navercorp.pinpoint.common.server.bo.codec.stat.strategy.JoinIntFieldEncodingStrategy)

Example 5 with AgentStatHeaderDecoder

use of com.navercorp.pinpoint.common.server.bo.codec.stat.header.AgentStatHeaderDecoder 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;
}
Also used : BitCountingHeaderDecoder(com.navercorp.pinpoint.common.server.bo.codec.stat.header.BitCountingHeaderDecoder) ArrayList(java.util.ArrayList) JoinStatBo(com.navercorp.pinpoint.common.server.bo.stat.join.JoinStatBo) JoinLongFieldEncodingStrategy(com.navercorp.pinpoint.common.server.bo.codec.stat.strategy.JoinLongFieldEncodingStrategy) JoinLongFieldBo(com.navercorp.pinpoint.common.server.bo.stat.join.JoinLongFieldBo) AgentStatHeaderDecoder(com.navercorp.pinpoint.common.server.bo.codec.stat.header.AgentStatHeaderDecoder) JoinMemoryBo(com.navercorp.pinpoint.common.server.bo.stat.join.JoinMemoryBo)

Aggregations

AgentStatHeaderDecoder (com.navercorp.pinpoint.common.server.bo.codec.stat.header.AgentStatHeaderDecoder)24 BitCountingHeaderDecoder (com.navercorp.pinpoint.common.server.bo.codec.stat.header.BitCountingHeaderDecoder)24 ArrayList (java.util.ArrayList)23 JoinStatBo (com.navercorp.pinpoint.common.server.bo.stat.join.JoinStatBo)9 JoinLongFieldEncodingStrategy (com.navercorp.pinpoint.common.server.bo.codec.stat.strategy.JoinLongFieldEncodingStrategy)8 JoinLongFieldBo (com.navercorp.pinpoint.common.server.bo.stat.join.JoinLongFieldBo)8 JvmGcType (com.navercorp.pinpoint.common.server.bo.JvmGcType)2 JoinIntFieldEncodingStrategy (com.navercorp.pinpoint.common.server.bo.codec.stat.strategy.JoinIntFieldEncodingStrategy)2 ActiveTraceBo (com.navercorp.pinpoint.common.server.bo.stat.ActiveTraceBo)2 AgentStatDataPoint (com.navercorp.pinpoint.common.server.bo.stat.AgentStatDataPoint)2 CpuLoadBo (com.navercorp.pinpoint.common.server.bo.stat.CpuLoadBo)2 JvmGcBo (com.navercorp.pinpoint.common.server.bo.stat.JvmGcBo)2 JvmGcDetailedBo (com.navercorp.pinpoint.common.server.bo.stat.JvmGcDetailedBo)2 TransactionBo (com.navercorp.pinpoint.common.server.bo.stat.TransactionBo)2 JoinIntFieldBo (com.navercorp.pinpoint.common.server.bo.stat.join.JoinIntFieldBo)2 SlotType (com.navercorp.pinpoint.common.trace.SlotType)2 HashMap (java.util.HashMap)2 AgentStatDataPointCodec (com.navercorp.pinpoint.common.server.bo.codec.stat.AgentStatDataPointCodec)1 JvmGcCodecV2 (com.navercorp.pinpoint.common.server.bo.codec.stat.v2.JvmGcCodecV2)1 DataSourceBo (com.navercorp.pinpoint.common.server.bo.stat.DataSourceBo)1