Search in sources :

Example 6 with Application

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

the class ErrorRateToCalleCheckerTest method checkTest.

@Test
public void checkTest() {
    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.ERROR_RATE_TO_CALLEE.getName(), 50, "testGroup", false, false, TO_SERVICE_NAME + 1);
    ErrorRateToCalleeChecker checker = new ErrorRateToCalleeChecker(dataCollector, rule);
    checker.check();
    assertTrue(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) ErrorRateToCalleeChecker(com.navercorp.pinpoint.web.alarm.checker.ErrorRateToCalleeChecker) Test(org.junit.Test)

Example 7 with Application

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

the class HeapUsageRateCheckerTest method checkTest1.

@Test
public void checkTest1() {
    Rule rule = new Rule(SERVICE_NAME, SERVICE_TYPE, CheckerCategory.HEAP_USAGE_RATE.getName(), 70, "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 HeapUsageRateChecker(collector, rule);
    checker.check();
    assertTrue(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 8 with Application

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

the class JvmCpuUsageRateCheckerTest method checkTest1.

@Test
public void checkTest1() {
    Rule rule = new Rule(SERVICE_NAME, SERVICE_TYPE, CheckerCategory.JVM_CPU_USAGE_RATE.getName(), 60, "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();
    assertTrue(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 9 with Application

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

the class AgentTimeHistogramTest method testViewModel.

@Test
public void testViewModel() throws IOException {
    Application app = new Application("test", ServiceType.STAND_ALONE);
    AgentTimeHistogramBuilder builder = new AgentTimeHistogramBuilder(app, new Range(0, 1000 * 60));
    List<ResponseTime> responseHistogramList = createResponseTime(app, "test1", "test2");
    AgentTimeHistogram histogram = builder.build(responseHistogramList);
    List<AgentResponseTimeViewModel> viewModel = histogram.createViewModel();
    logger.debug("{}", viewModel);
    JsonFactory jsonFactory = mapper.getFactory();
    StringWriter stringWriter = new StringWriter();
    JsonGenerator jsonGenerator = jsonFactory.createGenerator(stringWriter);
    jsonGenerator.writeStartObject();
    for (AgentResponseTimeViewModel agentResponseTimeViewModel : viewModel) {
        jsonGenerator.writeObject(agentResponseTimeViewModel);
    }
    jsonGenerator.writeEndObject();
    jsonGenerator.flush();
    jsonGenerator.close();
    logger.debug(stringWriter.toString());
}
Also used : AgentTimeHistogramBuilder(com.navercorp.pinpoint.web.applicationmap.histogram.AgentTimeHistogramBuilder) AgentTimeHistogram(com.navercorp.pinpoint.web.applicationmap.histogram.AgentTimeHistogram) AgentResponseTimeViewModel(com.navercorp.pinpoint.web.view.AgentResponseTimeViewModel) StringWriter(java.io.StringWriter) JsonFactory(com.fasterxml.jackson.core.JsonFactory) JsonGenerator(com.fasterxml.jackson.core.JsonGenerator) ResponseTime(com.navercorp.pinpoint.web.vo.ResponseTime) Range(com.navercorp.pinpoint.web.vo.Range) Application(com.navercorp.pinpoint.web.vo.Application) Test(org.junit.Test)

Example 10 with Application

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

the class AgentHistogramTest method testDeepCopy.

@Test
public void testDeepCopy() throws Exception {
    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)

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