Search in sources :

Example 1 with HistogramSlot

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

the class LongAdderHistogram method addResponseTime.

public void addResponseTime(int millis, boolean error) {
    final HistogramSlot histogramSlot = histogramSchema.findHistogramSlot(millis, error);
    final SlotType slotType = histogramSlot.getSlotType();
    switch(slotType) {
        case FAST:
            fastCounter.increment();
            return;
        case FAST_ERROR:
            fastErrorCounter.increment();
            return;
        case NORMAL:
            normalCounter.increment();
            return;
        case NORMAL_ERROR:
            normalErrorCounter.increment();
            return;
        case SLOW:
            slowCounter.increment();
            return;
        case SLOW_ERROR:
            slowErrorCounter.increment();
            return;
        case VERY_SLOW:
            verySlowCounter.increment();
            return;
        case VERY_SLOW_ERROR:
            verySlowErrorCounter.increment();
            return;
        default:
            throw new IllegalArgumentException("slot ServiceTypeInfo notFound:" + slotType);
    }
}
Also used : HistogramSlot(com.navercorp.pinpoint.common.trace.HistogramSlot) SlotType(com.navercorp.pinpoint.common.trace.SlotType)

Example 2 with HistogramSlot

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

the class ApplicationMapStatisticsUtils method findResponseHistogramSlotNo.

private static short findResponseHistogramSlotNo(ServiceType serviceType, int elapsed, boolean isError) {
    if (serviceType == null) {
        throw new NullPointerException("serviceType must not be null");
    }
    final HistogramSchema histogramSchema = serviceType.getHistogramSchema();
    final HistogramSlot histogramSlot = histogramSchema.findHistogramSlot(elapsed, isError);
    return histogramSlot.getSlotTime();
}
Also used : HistogramSlot(com.navercorp.pinpoint.common.trace.HistogramSlot) HistogramSchema(com.navercorp.pinpoint.common.trace.HistogramSchema)

Example 3 with HistogramSlot

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

the class ResponseTimeMapperTest method testResponseTimeMapperTest.

@Test
public void testResponseTimeMapperTest() throws Exception {
    Buffer buffer = new AutomaticBuffer();
    HistogramSlot histogramSlot = ServiceType.STAND_ALONE.getHistogramSchema().findHistogramSlot(1000, false);
    short histogramSlotTime = histogramSlot.getSlotTime();
    buffer.putShort(histogramSlotTime);
    buffer.putBytes(Bytes.toBytes("agent"));
    byte[] bufferArray = buffer.getBuffer();
    byte[] valueArray = Bytes.toBytes(1L);
    Cell mockCell = CellUtil.createCell(HConstants.EMPTY_BYTE_ARRAY, HConstants.EMPTY_BYTE_ARRAY, bufferArray, HConstants.LATEST_TIMESTAMP, KeyValue.Type.Maximum.getCode(), valueArray);
    ResponseTimeMapper responseTimeMapper = new ResponseTimeMapper();
    ResponseTime responseTime = new ResponseTime("applicationName", ServiceType.STAND_ALONE, System.currentTimeMillis());
    responseTimeMapper.recordColumn(responseTime, mockCell);
    Histogram agentHistogram = responseTime.findHistogram("agent");
    long fastCount = agentHistogram.getFastCount();
    Assert.assertEquals(fastCount, 1);
    long normal = agentHistogram.getNormalCount();
    Assert.assertEquals(normal, 0);
    long slow = agentHistogram.getSlowCount();
    Assert.assertEquals(slow, 0);
}
Also used : Buffer(com.navercorp.pinpoint.common.buffer.Buffer) AutomaticBuffer(com.navercorp.pinpoint.common.buffer.AutomaticBuffer) HistogramSlot(com.navercorp.pinpoint.common.trace.HistogramSlot) Histogram(com.navercorp.pinpoint.web.applicationmap.histogram.Histogram) AutomaticBuffer(com.navercorp.pinpoint.common.buffer.AutomaticBuffer) ResponseTime(com.navercorp.pinpoint.web.vo.ResponseTime) Cell(org.apache.hadoop.hbase.Cell) Test(org.junit.Test)

Example 4 with HistogramSlot

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

the class FilteredMapServiceImpl method getHistogramSlotTime.

private short getHistogramSlotTime(boolean hasException, int elapsedTime, ServiceType serviceType) {
    final HistogramSchema schema = serviceType.getHistogramSchema();
    final HistogramSlot histogramSlot = schema.findHistogramSlot(elapsedTime, hasException);
    return histogramSlot.getSlotTime();
}
Also used : HistogramSlot(com.navercorp.pinpoint.common.trace.HistogramSlot) HistogramSchema(com.navercorp.pinpoint.common.trace.HistogramSchema)

Example 5 with HistogramSlot

use of com.navercorp.pinpoint.common.trace.HistogramSlot 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

HistogramSlot (com.navercorp.pinpoint.common.trace.HistogramSlot)6 HistogramSchema (com.navercorp.pinpoint.common.trace.HistogramSchema)2 SlotType (com.navercorp.pinpoint.common.trace.SlotType)2 AutomaticBuffer (com.navercorp.pinpoint.common.buffer.AutomaticBuffer)1 Buffer (com.navercorp.pinpoint.common.buffer.Buffer)1 Histogram (com.navercorp.pinpoint.web.applicationmap.histogram.Histogram)1 ResponseTime (com.navercorp.pinpoint.web.vo.ResponseTime)1 ArrayList (java.util.ArrayList)1 LinkedHashMap (java.util.LinkedHashMap)1 Cell (org.apache.hadoop.hbase.Cell)1 Test (org.junit.Test)1