Search in sources :

Example 21 with TimeHistogram

use of com.navercorp.pinpoint.web.applicationmap.histogram.TimeHistogram in project pinpoint by pinpoint-apm.

the class MapStatisticsCallerDataCollector method getCount.

public long getCount(String calleName, DataCategory dataCategory) {
    final LinkCallData linkCallData = calleeStatMap.get(calleName);
    if (linkCallData == null) {
        return 0;
    }
    long count = 0;
    switch(dataCategory) {
        case SLOW_COUNT:
            for (TimeHistogram timeHistogram : linkCallData.getTimeHistogram()) {
                count += timeHistogram.getSlowCount();
                count += timeHistogram.getVerySlowCount();
            }
            break;
        case ERROR_COUNT:
            for (TimeHistogram timeHistogram : linkCallData.getTimeHistogram()) {
                count += timeHistogram.getTotalErrorCount();
            }
            break;
        case TOTAL_COUNT:
            for (TimeHistogram timeHistogram : linkCallData.getTimeHistogram()) {
                count += timeHistogram.getTotalCount();
            }
            break;
        default:
            throw new IllegalArgumentException("Can't count for " + dataCategory);
    }
    return count;
}
Also used : TimeHistogram(com.navercorp.pinpoint.web.applicationmap.histogram.TimeHistogram) LinkCallData(com.navercorp.pinpoint.web.applicationmap.rawdata.LinkCallData)

Example 22 with TimeHistogram

use of com.navercorp.pinpoint.web.applicationmap.histogram.TimeHistogram in project pinpoint by pinpoint-apm.

the class ResponseTime method getHistogram.

private Histogram getHistogram(String agentId) {
    Objects.requireNonNull(agentId, "agentId");
    TimeHistogram histogram = responseHistogramMap.computeIfAbsent(agentId, k -> new TimeHistogram(applicationServiceType, timeStamp));
    return histogram;
}
Also used : TimeHistogram(com.navercorp.pinpoint.web.applicationmap.histogram.TimeHistogram)

Example 23 with TimeHistogram

use of com.navercorp.pinpoint.web.applicationmap.histogram.TimeHistogram in project pinpoint by pinpoint-apm.

the class AgentHistogramTest method testDeepCopy.

@Test
public void testDeepCopy() {
    AgentHistogram agentHistogram = new AgentHistogram(new Application("test", ServiceType.STAND_ALONE));
    TimeHistogram histogram = new TimeHistogram(ServiceType.STAND_ALONE, 0);
    histogram.addCallCount(ServiceType.STAND_ALONE.getHistogramSchema().getFastErrorSlot().getSlotTime(), 1);
    agentHistogram.addTimeHistogram(histogram);
    AgentHistogram copy = new AgentHistogram(agentHistogram);
    Assert.assertEquals(copy.getHistogram().getTotalErrorCount(), 1);
    TimeHistogram histogram2 = new TimeHistogram(ServiceType.STAND_ALONE, 0);
    histogram2.addCallCount(ServiceType.STAND_ALONE.getHistogramSchema().getFastErrorSlot().getSlotTime(), 2);
    agentHistogram.addTimeHistogram(histogram2);
    Assert.assertEquals(agentHistogram.getHistogram().getTotalErrorCount(), 3);
    Assert.assertEquals(copy.getHistogram().getTotalErrorCount(), 1);
}
Also used : Application(com.navercorp.pinpoint.web.vo.Application) TimeHistogram(com.navercorp.pinpoint.web.applicationmap.histogram.TimeHistogram) Test(org.junit.Test)

Example 24 with TimeHistogram

use of com.navercorp.pinpoint.web.applicationmap.histogram.TimeHistogram in project pinpoint by pinpoint-apm.

the class AgentHistogramTest method testJsonCompatibility.

@Test
public void testJsonCompatibility() throws Exception {
    // compatibility test for changing to Jackson
    AgentHistogram agentHistogram = new AgentHistogram(new Application("test", ServiceType.STAND_ALONE));
    TimeHistogram histogram = new TimeHistogram(ServiceType.STAND_ALONE, 0);
    histogram.addCallCount(ServiceType.STAND_ALONE.getHistogramSchema().getFastErrorSlot().getSlotTime(), 1);
    agentHistogram.addTimeHistogram(histogram);
    AgentHistogram copy = new AgentHistogram(agentHistogram);
    logger.debug(copy.getHistogram().toString());
    Assert.assertEquals(copy.getHistogram().getTotalErrorCount(), 1);
    TimeHistogram histogram2 = new TimeHistogram(ServiceType.STAND_ALONE, 0);
    histogram2.addCallCount(ServiceType.STAND_ALONE.getHistogramSchema().getFastErrorSlot().getSlotTime(), 2);
    agentHistogram.addTimeHistogram(histogram2);
    Assert.assertEquals(agentHistogram.getHistogram().getTotalErrorCount(), 3);
    String callJson = mapper.writeValueAsString(agentHistogram);
    String before = originalJson(agentHistogram);
    logger.debug("callJson:{}", callJson);
    HashMap callJsonHashMap = mapper.readValue(callJson, HashMap.class);
    logger.debug("BEFORE:{}", before);
    HashMap beforeJsonHashMap = mapper.readValue(before, HashMap.class);
    logger.debug("{} {}", callJsonHashMap, beforeJsonHashMap);
    Assert.assertEquals(callJsonHashMap, beforeJsonHashMap);
}
Also used : HashMap(java.util.HashMap) Application(com.navercorp.pinpoint.web.vo.Application) TimeHistogram(com.navercorp.pinpoint.web.applicationmap.histogram.TimeHistogram) Test(org.junit.Test)

Example 25 with TimeHistogram

use of com.navercorp.pinpoint.web.applicationmap.histogram.TimeHistogram in project pinpoint by naver.

the class ResponseTime method getHistogram.

private Histogram getHistogram(String agentId) {
    Objects.requireNonNull(agentId, "agentId");
    TimeHistogram histogram = responseHistogramMap.computeIfAbsent(agentId, k -> new TimeHistogram(applicationServiceType, timeStamp));
    return histogram;
}
Also used : TimeHistogram(com.navercorp.pinpoint.web.applicationmap.histogram.TimeHistogram)

Aggregations

TimeHistogram (com.navercorp.pinpoint.web.applicationmap.histogram.TimeHistogram)29 LinkCallData (com.navercorp.pinpoint.web.applicationmap.rawdata.LinkCallData)8 Application (com.navercorp.pinpoint.web.vo.Application)5 LinkKey (com.navercorp.pinpoint.web.vo.LinkKey)4 Test (org.junit.Test)4 LinkCallDataMap (com.navercorp.pinpoint.web.applicationmap.rawdata.LinkCallDataMap)2 LinkData (com.navercorp.pinpoint.web.applicationmap.rawdata.LinkData)2 HashMap (java.util.HashMap)2 AcceptApplication (com.navercorp.pinpoint.web.service.map.AcceptApplication)1 RpcApplication (com.navercorp.pinpoint.web.service.map.RpcApplication)1