Search in sources :

Example 11 with Application

use of com.navercorp.pinpoint.web.vo.Application in project pinpoint by naver.

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 12 with Application

use of com.navercorp.pinpoint.web.vo.Application in project pinpoint by naver.

the class JvmCpuUsageRateCheckerTest method checkTest2.

@Test
public void checkTest2() {
    Rule rule = new Rule(SERVICE_NAME, SERVICE_TYPE, CheckerCategory.JVM_CPU_USAGE_RATE.getName(), 61, "testGroup", false, false, "");
    Application application = new Application(SERVICE_NAME, ServiceType.STAND_ALONE);
    AgentStatDataCollector collector = new AgentStatDataCollector(DataCollectorCategory.AGENT_STAT, application, jvmGcDao, cpuLoadDao, applicationIndexDao, System.currentTimeMillis(), DataCollectorFactory.SLOT_INTERVAL_FIVE_MIN);
    AgentChecker checker = new JvmCpuUsageRateChecker(collector, rule);
    checker.check();
    assertFalse(checker.isDetected());
}
Also used : AgentStatDataCollector(com.navercorp.pinpoint.web.alarm.collector.AgentStatDataCollector) Rule(com.navercorp.pinpoint.web.alarm.vo.Rule) Application(com.navercorp.pinpoint.web.vo.Application) Test(org.junit.Test)

Example 13 with Application

use of com.navercorp.pinpoint.web.vo.Application in project pinpoint by naver.

the class SlowCountCheckerTest method checkTest2.

/*
     * alert conditions not satisfied
     */
@Test
public void checkTest2() {
    Application application = new Application(SERVICE_NAME, ServiceType.STAND_ALONE);
    ResponseTimeDataCollector collector = new ResponseTimeDataCollector(DataCollectorCategory.RESPONSE_TIME, application, mockMapResponseDAO, System.currentTimeMillis(), 300000);
    Rule rule = new Rule(SERVICE_NAME, SERVICE_TYPE, CheckerCategory.SLOW_COUNT.getName(), 76, "testGroup", false, false, "");
    SlowCountChecker checker = new SlowCountChecker(collector, rule);
    checker.check();
    assertFalse(checker.isDetected());
}
Also used : SlowCountChecker(com.navercorp.pinpoint.web.alarm.checker.SlowCountChecker) Rule(com.navercorp.pinpoint.web.alarm.vo.Rule) Application(com.navercorp.pinpoint.web.vo.Application) ResponseTimeDataCollector(com.navercorp.pinpoint.web.alarm.collector.ResponseTimeDataCollector) Test(org.junit.Test)

Example 14 with Application

use of com.navercorp.pinpoint.web.vo.Application in project pinpoint by naver.

the class SlowCountToCalleCheckerTest method checkTest2.

@Test
public void checkTest2() {
    Application application = new Application(FROM_SERVICE_NAME, ServiceType.STAND_ALONE);
    MapStatisticsCallerDataCollector dataCollector = new MapStatisticsCallerDataCollector(DataCollectorCategory.CALLER_STAT, application, dao, System.currentTimeMillis(), 300000);
    Rule rule = new Rule(FROM_SERVICE_NAME, SERVICE_TYPE, CheckerCategory.SLOW_COUNT_TO_CALLEE.getName(), 8, "testGroup", false, false, TO_SERVICE_NAME + 1);
    SlowCountToCalleeChecker checker = new SlowCountToCalleeChecker(dataCollector, rule);
    checker.check();
    assertFalse(checker.isDetected());
}
Also used : MapStatisticsCallerDataCollector(com.navercorp.pinpoint.web.alarm.collector.MapStatisticsCallerDataCollector) Rule(com.navercorp.pinpoint.web.alarm.vo.Rule) Application(com.navercorp.pinpoint.web.vo.Application) Test(org.junit.Test)

Example 15 with Application

use of com.navercorp.pinpoint.web.vo.Application in project pinpoint by naver.

the class SlowRateToCalleCheckerTest method checkTest2.

@Test
public void checkTest2() {
    Application application = new Application(FROM_SERVICE_NAME, ServiceType.STAND_ALONE);
    MapStatisticsCallerDataCollector dataCollector = new MapStatisticsCallerDataCollector(DataCollectorCategory.CALLER_STAT, application, dao, System.currentTimeMillis(), 300000);
    Rule rule = new Rule(FROM_SERVICE_NAME, SERVICE_TYPE, CheckerCategory.SLOW_RATE_TO_CALLEE.getName(), 71, "testGroup", false, false, TO_SERVICE_NAME + 1);
    SlowRateToCalleeChecker checker = new SlowRateToCalleeChecker(dataCollector, rule);
    checker.check();
    assertFalse(checker.isDetected());
}
Also used : MapStatisticsCallerDataCollector(com.navercorp.pinpoint.web.alarm.collector.MapStatisticsCallerDataCollector) Rule(com.navercorp.pinpoint.web.alarm.vo.Rule) Application(com.navercorp.pinpoint.web.vo.Application) SlowRateToCalleeChecker(com.navercorp.pinpoint.web.alarm.checker.SlowRateToCalleeChecker) Test(org.junit.Test)

Aggregations

Application (com.navercorp.pinpoint.web.vo.Application)90 Test (org.junit.Test)39 Rule (com.navercorp.pinpoint.web.alarm.vo.Rule)30 MapStatisticsCallerDataCollector (com.navercorp.pinpoint.web.alarm.collector.MapStatisticsCallerDataCollector)15 ResponseTimeDataCollector (com.navercorp.pinpoint.web.alarm.collector.ResponseTimeDataCollector)11 AcceptApplication (com.navercorp.pinpoint.web.service.map.AcceptApplication)11 RpcApplication (com.navercorp.pinpoint.web.service.map.RpcApplication)10 Range (com.navercorp.pinpoint.web.vo.Range)10 AgentHistogram (com.navercorp.pinpoint.web.applicationmap.rawdata.AgentHistogram)5 List (java.util.List)5 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)5 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)5 AgentStatDataCollector (com.navercorp.pinpoint.web.alarm.collector.AgentStatDataCollector)4 AgentHistogramList (com.navercorp.pinpoint.web.applicationmap.rawdata.AgentHistogramList)4 LinkDataMap (com.navercorp.pinpoint.web.applicationmap.rawdata.LinkDataMap)4 ArrayList (java.util.ArrayList)4 Buffer (com.navercorp.pinpoint.common.buffer.Buffer)3 ServiceType (com.navercorp.pinpoint.common.trace.ServiceType)3 ErrorCountToCalleeChecker (com.navercorp.pinpoint.web.alarm.checker.ErrorCountToCalleeChecker)3 ErrorRateToCalleeChecker (com.navercorp.pinpoint.web.alarm.checker.ErrorRateToCalleeChecker)3