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