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);
}
}
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();
}
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);
}
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();
}
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);
}
Aggregations