Search in sources :

Example 6 with HistogramSchema

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();
}
Also used : HistogramSchema(com.navercorp.pinpoint.common.trace.HistogramSchema)

Example 7 with HistogramSchema

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);
}
Also used : Histogram(com.navercorp.pinpoint.web.applicationmap.histogram.Histogram) HistogramSchema(com.navercorp.pinpoint.common.trace.HistogramSchema) HashMap(java.util.HashMap) Test(org.junit.Test)

Example 8 with HistogramSchema

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;
}
Also used : HistogramSchema(com.navercorp.pinpoint.common.trace.HistogramSchema) ServiceType(com.navercorp.pinpoint.common.trace.ServiceType) ResponseTimeViewModel(com.navercorp.pinpoint.web.view.ResponseTimeViewModel)

Example 9 with HistogramSchema

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();
}
Also used : HistogramSlot(com.navercorp.pinpoint.common.trace.HistogramSlot) HistogramSchema(com.navercorp.pinpoint.common.trace.HistogramSchema)

Example 10 with HistogramSchema

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);
}
Also used : HistogramSchema(com.navercorp.pinpoint.common.trace.HistogramSchema) Histogram(com.navercorp.pinpoint.web.applicationmap.histogram.Histogram) HashMap(java.util.HashMap) Test(org.junit.Test)

Aggregations

HistogramSchema (com.navercorp.pinpoint.common.trace.HistogramSchema)13 Test (org.junit.Test)5 HistogramSlot (com.navercorp.pinpoint.common.trace.HistogramSlot)2 ServiceType (com.navercorp.pinpoint.common.trace.ServiceType)2 SlotType (com.navercorp.pinpoint.common.trace.SlotType)2 HistogramSnapshot (com.navercorp.pinpoint.profiler.monitor.metric.rpc.HistogramSnapshot)2 Histogram (com.navercorp.pinpoint.web.applicationmap.histogram.Histogram)2 ResponseTimeViewModel (com.navercorp.pinpoint.web.view.ResponseTimeViewModel)2 HashMap (java.util.HashMap)2 ActiveTraceBo (com.navercorp.pinpoint.common.server.bo.stat.ActiveTraceBo)1 BaseHistogramSchema (com.navercorp.pinpoint.common.trace.BaseHistogramSchema)1 DefaultRpcMetric (com.navercorp.pinpoint.profiler.monitor.metric.rpc.DefaultRpcMetric)1 LongAdderHistogram (com.navercorp.pinpoint.profiler.monitor.metric.rpc.LongAdderHistogram)1 AgentResponseTimeViewModel (com.navercorp.pinpoint.web.view.AgentResponseTimeViewModel)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 ArrayList (java.util.ArrayList)1