Search in sources :

Example 11 with SlotType

use of com.navercorp.pinpoint.common.trace.SlotType in project pinpoint by naver.

the class ActiveTraceBoMapper method map.

@Override
public ActiveTraceBo map(TActiveTrace tActiveTrace) {
    TActiveTraceHistogram tActiveTraceHistogram = tActiveTrace.getHistogram();
    Map<SlotType, Integer> activeTraceCounts = createActiveTraceCountMap(tActiveTraceHistogram.getActiveTraceCount());
    ActiveTraceBo activeTraceBo = new ActiveTraceBo();
    activeTraceBo.setVersion(tActiveTraceHistogram.getVersion());
    activeTraceBo.setHistogramSchemaType(tActiveTraceHistogram.getHistogramSchemaType());
    activeTraceBo.setActiveTraceCounts(activeTraceCounts);
    return activeTraceBo;
}
Also used : TActiveTraceHistogram(com.navercorp.pinpoint.thrift.dto.TActiveTraceHistogram) SlotType(com.navercorp.pinpoint.common.trace.SlotType) ActiveTraceBo(com.navercorp.pinpoint.common.server.bo.stat.ActiveTraceBo)

Example 12 with SlotType

use of com.navercorp.pinpoint.common.trace.SlotType in project pinpoint by naver.

the class ActiveTraceCodecV2 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> 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<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.setStartTimestamp(startTimestamps.get(i));
        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 13 with SlotType

use of com.navercorp.pinpoint.common.trace.SlotType in project pinpoint by naver.

the class ActiveTraceHistogramFactory method createHistogram.

public ActiveTraceHistogram createHistogram() {
    Map<SlotType, IntAdder> mappedSlot = new LinkedHashMap<SlotType, IntAdder>(activeTraceSlotsCount);
    for (SlotType slotType : ACTIVE_TRACE_SLOTS_ORDER) {
        mappedSlot.put(slotType, new IntAdder(0));
    }
    long currentTime = System.currentTimeMillis();
    List<ActiveTraceInfo> collectedActiveTraceInfo = activeTraceRepository.collect();
    for (ActiveTraceInfo activeTraceInfo : collectedActiveTraceInfo) {
        HistogramSlot slot = histogramSchema.findHistogramSlot((int) (currentTime - activeTraceInfo.getStartTime()), false);
        mappedSlot.get(slot.getSlotType()).incrementAndGet();
    }
    List<Integer> activeTraceCount = new ArrayList<Integer>(activeTraceSlotsCount);
    for (IntAdder statusCount : mappedSlot.values()) {
        activeTraceCount.add(statusCount.get());
    }
    return new ActiveTraceHistogram(this.histogramSchema, activeTraceCount);
}
Also used : HistogramSlot(com.navercorp.pinpoint.common.trace.HistogramSlot) ArrayList(java.util.ArrayList) LinkedHashMap(java.util.LinkedHashMap) SlotType(com.navercorp.pinpoint.common.trace.SlotType)

Aggregations

SlotType (com.navercorp.pinpoint.common.trace.SlotType)13 ActiveTraceBo (com.navercorp.pinpoint.common.server.bo.stat.ActiveTraceBo)7 ArrayList (java.util.ArrayList)7 HashMap (java.util.HashMap)4 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 UnsignedIntegerEncodingStrategy (com.navercorp.pinpoint.common.server.bo.codec.stat.strategy.UnsignedIntegerEncodingStrategy)2 UnsignedShortEncodingStrategy (com.navercorp.pinpoint.common.server.bo.codec.stat.strategy.UnsignedShortEncodingStrategy)2 HistogramSchema (com.navercorp.pinpoint.common.trace.HistogramSchema)2 HistogramSlot (com.navercorp.pinpoint.common.trace.HistogramSlot)2 Map (java.util.Map)2 ActiveTraceHistogramBo (com.navercorp.pinpoint.common.server.bo.ActiveTraceHistogramBo)1 BaseHistogramSchema (com.navercorp.pinpoint.common.trace.BaseHistogramSchema)1 TActiveTraceHistogram (com.navercorp.pinpoint.thrift.dto.TActiveTraceHistogram)1 DataPoint (com.navercorp.pinpoint.web.vo.chart.DataPoint)1 TitledDataPoint (com.navercorp.pinpoint.web.vo.chart.TitledDataPoint)1 SampledActiveTrace (com.navercorp.pinpoint.web.vo.stat.SampledActiveTrace)1 LinkedHashMap (java.util.LinkedHashMap)1 Test (org.junit.Test)1