use of com.navercorp.pinpoint.common.trace.HistogramSchema in project pinpoint by naver.
the class HistogramSerializerTest method internalJson.
/**
* moved this testcase for testing the old version histogram with manually created json code
* @param histogram
* @return
*/
public String internalJson(Histogram histogram) {
HistogramSchema histogramSchema = histogram.getHistogramSchema();
final StringBuilder sb = new StringBuilder(128);
sb.append("{ ");
appendSlotTimeAndCount(sb, histogramSchema.getFastSlot().getSlotName(), histogram.getFastCount());
sb.append(", ");
appendSlotTimeAndCount(sb, histogramSchema.getNormalSlot().getSlotName(), histogram.getNormalCount());
sb.append(", ");
appendSlotTimeAndCount(sb, histogramSchema.getSlowSlot().getSlotName(), histogram.getSlowCount());
sb.append(", ");
// very slow means 0, so should use slow
appendSlotTimeAndCount(sb, histogramSchema.getVerySlowSlot().getSlotName(), histogram.getVerySlowCount());
sb.append(", ");
appendSlotTimeAndCount(sb, histogramSchema.getErrorSlot().getSlotName(), histogram.getTotalErrorCount());
sb.append(" }");
return sb.toString();
}
use of com.navercorp.pinpoint.common.trace.HistogramSchema in project pinpoint by naver.
the class HistogramSerializerTest method testSerialize.
@Test
public void testSerialize() throws Exception {
Histogram original = new Histogram(ServiceType.STAND_ALONE);
HistogramSchema schema = original.getHistogramSchema();
original.addCallCount(schema.getFastSlot().getSlotTime(), 1);
original.addCallCount(schema.getNormalSlot().getSlotTime(), 2);
original.addCallCount(schema.getSlowSlot().getSlotTime(), 3);
original.addCallCount(schema.getVerySlowSlot().getSlotTime(), 4);
original.addCallCount(schema.getNormalErrorSlot().getSlotTime(), 5);
String jacksonJson = objectMapper.writeValueAsString(original);
HashMap objectMapperHashMap = objectMapper.readValue(jacksonJson, HashMap.class);
logger.debug(jacksonJson);
String internalJson = internalJson(original);
HashMap hashMap = objectMapper.readValue(internalJson, HashMap.class);
Assert.assertEquals(objectMapperHashMap, hashMap);
}
use of com.navercorp.pinpoint.common.trace.HistogramSchema in project pinpoint by naver.
the class ApplicationTimeHistogram method createViewModel.
public List<ResponseTimeViewModel> createViewModel() {
final List<ResponseTimeViewModel> value = new ArrayList<>(5);
ServiceType serviceType = application.getServiceType();
HistogramSchema schema = serviceType.getHistogramSchema();
value.add(new ResponseTimeViewModel(schema.getFastSlot().getSlotName(), getColumnValue(SlotType.FAST)));
// value.add(new ResponseTimeViewModel(schema.getFastErrorSlot().getSlotName(), getColumnValue(SlotType.FAST_ERROR)));
value.add(new ResponseTimeViewModel(schema.getNormalSlot().getSlotName(), getColumnValue(SlotType.NORMAL)));
// value.add(new ResponseTimeViewModel(schema.getNormalErrorSlot().getSlotName(), getColumnValue(SlotType.NORMAL_ERROR)));
value.add(new ResponseTimeViewModel(schema.getSlowSlot().getSlotName(), getColumnValue(SlotType.SLOW)));
// value.add(new ResponseTimeViewModel(schema.getSlowErrorSlot().getSlotName(), getColumnValue(SlotType.SLOW_ERROR)));
value.add(new ResponseTimeViewModel(schema.getVerySlowSlot().getSlotName(), getColumnValue(SlotType.VERY_SLOW)));
// value.add(new ResponseTimeViewModel(schema.getVerySlowErrorSlot().getSlotName(), getColumnValue(SlotType.VERY_SLOW_ERROR)));
value.add(new ResponseTimeViewModel(schema.getErrorSlot().getSlotName(), getColumnValue(SlotType.ERROR)));
return value;
}
use of com.navercorp.pinpoint.common.trace.HistogramSchema 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.HistogramSchema in project pinpoint by naver.
the class HistogramTest method testJson.
@Test
public void testJson() throws Exception {
HistogramSchema schema = ServiceType.STAND_ALONE.getHistogramSchema();
Histogram original = new Histogram(ServiceType.STAND_ALONE);
original.addCallCount(schema.getFastSlot().getSlotTime(), 100);
String json = objectMapper.writeValueAsString(original);
HashMap hashMap = objectMapper.readValue(json, HashMap.class);
Assert.assertEquals(hashMap.get(schema.getFastSlot().getSlotName()), 100);
Assert.assertEquals(hashMap.get(schema.getErrorSlot().getSlotName()), 0);
}
Aggregations