Search in sources :

Example 1 with Histogram

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

the class HistogramTest method testDeepCopy.

@Test
public void testDeepCopy() throws Exception {
    Histogram original = new Histogram(ServiceType.STAND_ALONE);
    original.addCallCount((short) 1000, 100);
    Histogram copy = new Histogram(ServiceType.STAND_ALONE);
    Assert.assertEquals(copy.getFastCount(), 0);
    copy.add(original);
    Assert.assertEquals(original.getFastCount(), copy.getFastCount());
    copy.addCallCount((short) 1000, 100);
    Assert.assertEquals(original.getFastCount(), 100);
    Assert.assertEquals(copy.getFastCount(), 200);
}
Also used : Histogram(com.navercorp.pinpoint.web.applicationmap.histogram.Histogram) Test(org.junit.Test)

Example 2 with Histogram

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

the class ResponseTime method addResponseTime.

public void addResponseTime(String agentId, short slotNumber, long count) {
    Histogram histogram = getHistogram(agentId);
    histogram.addCallCount(slotNumber, count);
}
Also used : TimeHistogram(com.navercorp.pinpoint.web.applicationmap.histogram.TimeHistogram) Histogram(com.navercorp.pinpoint.web.applicationmap.histogram.Histogram)

Example 3 with Histogram

use of com.navercorp.pinpoint.web.applicationmap.histogram.Histogram 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 4 with Histogram

use of com.navercorp.pinpoint.web.applicationmap.histogram.Histogram 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);
}
Also used : Buffer(com.navercorp.pinpoint.common.buffer.Buffer) AutomaticBuffer(com.navercorp.pinpoint.common.buffer.AutomaticBuffer) HistogramSlot(com.navercorp.pinpoint.common.trace.HistogramSlot) Histogram(com.navercorp.pinpoint.web.applicationmap.histogram.Histogram) AutomaticBuffer(com.navercorp.pinpoint.common.buffer.AutomaticBuffer) ResponseTime(com.navercorp.pinpoint.web.vo.ResponseTime) Cell(org.apache.hadoop.hbase.Cell) Test(org.junit.Test)

Example 5 with Histogram

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

the class ApplicationMapBuilder method filterAgentInfoByResponseData.

/**
     * Filters AgentInfo by whether they actually have response data.
     * For agents that do not have response data, check their status and include those that were alive.
     */
private Set<AgentInfo> filterAgentInfoByResponseData(Set<AgentInfo> agentList, long timestamp, Node node, AgentInfoService agentInfoService) {
    Set<AgentInfo> filteredAgentInfo = new HashSet<>();
    NodeHistogram nodeHistogram = node.getNodeHistogram();
    Map<String, Histogram> agentHistogramMap = nodeHistogram.getAgentHistogramMap();
    for (AgentInfo agentInfo : agentList) {
        String agentId = agentInfo.getAgentId();
        if (agentHistogramMap.containsKey(agentId)) {
            filteredAgentInfo.add(agentInfo);
        } else {
            AgentStatus status = agentInfoService.getAgentStatus(agentId, timestamp);
            agentInfo.setStatus(status);
            if (isAgentRunning(agentInfo)) {
                filteredAgentInfo.add(agentInfo);
            }
        }
    }
    return filteredAgentInfo;
}
Also used : AgentTimeHistogram(com.navercorp.pinpoint.web.applicationmap.histogram.AgentTimeHistogram) AgentHistogram(com.navercorp.pinpoint.web.applicationmap.rawdata.AgentHistogram) Histogram(com.navercorp.pinpoint.web.applicationmap.histogram.Histogram) ApplicationTimeHistogram(com.navercorp.pinpoint.web.applicationmap.histogram.ApplicationTimeHistogram) NodeHistogram(com.navercorp.pinpoint.web.applicationmap.histogram.NodeHistogram) AgentStatus(com.navercorp.pinpoint.web.vo.AgentStatus) AgentInfo(com.navercorp.pinpoint.web.vo.AgentInfo) NodeHistogram(com.navercorp.pinpoint.web.applicationmap.histogram.NodeHistogram) HashSet(java.util.HashSet)

Aggregations

Histogram (com.navercorp.pinpoint.web.applicationmap.histogram.Histogram)11 Test (org.junit.Test)4 NodeHistogram (com.navercorp.pinpoint.web.applicationmap.histogram.NodeHistogram)3 TimeHistogram (com.navercorp.pinpoint.web.applicationmap.histogram.TimeHistogram)3 AgentHistogram (com.navercorp.pinpoint.web.applicationmap.rawdata.AgentHistogram)3 HashMap (java.util.HashMap)3 HistogramSchema (com.navercorp.pinpoint.common.trace.HistogramSchema)2 AgentTimeHistogram (com.navercorp.pinpoint.web.applicationmap.histogram.AgentTimeHistogram)2 ApplicationTimeHistogram (com.navercorp.pinpoint.web.applicationmap.histogram.ApplicationTimeHistogram)2 Application (com.navercorp.pinpoint.web.vo.Application)2 AutomaticBuffer (com.navercorp.pinpoint.common.buffer.AutomaticBuffer)1 Buffer (com.navercorp.pinpoint.common.buffer.Buffer)1 HistogramSlot (com.navercorp.pinpoint.common.trace.HistogramSlot)1 ServiceType (com.navercorp.pinpoint.common.trace.ServiceType)1 AgentTimeHistogramBuilder (com.navercorp.pinpoint.web.applicationmap.histogram.AgentTimeHistogramBuilder)1 ApplicationTimeHistogramBuilder (com.navercorp.pinpoint.web.applicationmap.histogram.ApplicationTimeHistogramBuilder)1 AgentHistogramList (com.navercorp.pinpoint.web.applicationmap.rawdata.AgentHistogramList)1 LinkCallDataMap (com.navercorp.pinpoint.web.applicationmap.rawdata.LinkCallDataMap)1 AgentInfo (com.navercorp.pinpoint.web.vo.AgentInfo)1 AgentStatus (com.navercorp.pinpoint.web.vo.AgentStatus)1