Search in sources :

Example 1 with ResponseTimeDataCollector

use of com.navercorp.pinpoint.batch.alarm.collector.ResponseTimeDataCollector in project pinpoint by naver.

the class ErrorCountCheckerTest method checkTest1.

/*
     * alert conditions not satisfied
     */
@Test
public void checkTest1() {
    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.ERROR_COUNT.getName(), 74, "testGroup", false, false, false, "");
    ErrorCountChecker filter = new ErrorCountChecker(collector, rule);
    filter.check();
    assertTrue(filter.isDetected());
}
Also used : Rule(com.navercorp.pinpoint.web.alarm.vo.Rule) Application(com.navercorp.pinpoint.web.vo.Application) ResponseTimeDataCollector(com.navercorp.pinpoint.batch.alarm.collector.ResponseTimeDataCollector) Test(org.junit.Test)

Example 2 with ResponseTimeDataCollector

use of com.navercorp.pinpoint.batch.alarm.collector.ResponseTimeDataCollector in project pinpoint by naver.

the class ErrorCountCheckerTest 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.ERROR_COUNT.getName(), 76, "testGroup", false, false, false, "");
    ErrorCountChecker filter = new ErrorCountChecker(collector, rule);
    filter.check();
    assertFalse(filter.isDetected());
}
Also used : Rule(com.navercorp.pinpoint.web.alarm.vo.Rule) Application(com.navercorp.pinpoint.web.vo.Application) ResponseTimeDataCollector(com.navercorp.pinpoint.batch.alarm.collector.ResponseTimeDataCollector) Test(org.junit.Test)

Example 3 with ResponseTimeDataCollector

use of com.navercorp.pinpoint.batch.alarm.collector.ResponseTimeDataCollector in project pinpoint by naver.

the class ErrorRateCheckerTest 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.ERROR_RATE.getName(), 61, "testGroup", false, false, false, "");
    ErrorRateChecker filter = new ErrorRateChecker(collector, rule);
    filter.check();
    assertFalse(filter.isDetected());
}
Also used : Rule(com.navercorp.pinpoint.web.alarm.vo.Rule) Application(com.navercorp.pinpoint.web.vo.Application) ResponseTimeDataCollector(com.navercorp.pinpoint.batch.alarm.collector.ResponseTimeDataCollector) Test(org.junit.Test)

Example 4 with ResponseTimeDataCollector

use of com.navercorp.pinpoint.batch.alarm.collector.ResponseTimeDataCollector in project pinpoint by naver.

the class AlarmReaderTest method beforeClass.

@BeforeClass
public static void beforeClass() {
    applicationIndexDao = new ApplicationIndexDao() {

        @Override
        public List<Application> selectAllApplicationNames() {
            List<Application> apps = new LinkedList<>();
            for (int i = 0; i < 7; i++) {
                apps.add(new Application(APP_NAME + i, ServiceType.STAND_ALONE));
            }
            return apps;
        }

        @Override
        public List<Application> selectApplicationName(String applicationName) {
            List<Application> apps = new LinkedList<>();
            apps.add(new Application(APP_NAME, ServiceType.STAND_ALONE));
            return apps;
        }

        @Override
        public List<String> selectAgentIds(String applicationName) {
            return null;
        }

        @Override
        public void deleteApplicationName(String applicationName) {
        }

        @Override
        public void deleteAgentIds(Map<String, List<String>> applicationAgentIdMap) {
        }

        @Override
        public void deleteAgentId(String applicationName, String agentId) {
        }
    };
    alarmService = new AlarmServiceImpl(mock(AlarmDao.class), mock(WebhookSendInfoDao.class)) {

        private final Map<String, Rule> ruleMap;

        {
            ruleMap = new HashMap<>();
            for (int i = 0; i <= 6; i++) {
                ruleMap.put(APP_NAME + i, new Rule(APP_NAME + i, SERVICE_TYPE, CheckerCategory.SLOW_COUNT.getName(), 76, "testGroup", false, false, false, ""));
            }
        }

        @Override
        public List<Rule> selectRuleByApplicationId(String applicationId) {
            List<Rule> rules = new LinkedList<>();
            rules.add(ruleMap.get(applicationId));
            return rules;
        }
    };
    dataCollectorFactory = mock(DataCollectorFactory.class);
    when(dataCollectorFactory.createDataCollector(any(), any(), anyLong())).thenAnswer(new Answer<DataCollector>() {

        @Override
        public DataCollector answer(InvocationOnMock invocation) throws Throwable {
            return new ResponseTimeDataCollector(DataCollectorCategory.RESPONSE_TIME, null, null, 0, 0);
        }
    });
}
Also used : ApplicationIndexDao(com.navercorp.pinpoint.web.dao.ApplicationIndexDao) HashMap(java.util.HashMap) ResponseTimeDataCollector(com.navercorp.pinpoint.batch.alarm.collector.ResponseTimeDataCollector) DataCollector(com.navercorp.pinpoint.batch.alarm.collector.DataCollector) ResponseTimeDataCollector(com.navercorp.pinpoint.batch.alarm.collector.ResponseTimeDataCollector) InvocationOnMock(org.mockito.invocation.InvocationOnMock) AlarmServiceImpl(com.navercorp.pinpoint.web.service.AlarmServiceImpl) LinkedList(java.util.LinkedList) List(java.util.List) Rule(com.navercorp.pinpoint.web.alarm.vo.Rule) Application(com.navercorp.pinpoint.web.vo.Application) BeforeClass(org.junit.BeforeClass)

Example 5 with ResponseTimeDataCollector

use of com.navercorp.pinpoint.batch.alarm.collector.ResponseTimeDataCollector 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, false, "");
    SlowCountChecker checker = new SlowCountChecker(collector, rule);
    checker.check();
    assertFalse(checker.isDetected());
}
Also used : Rule(com.navercorp.pinpoint.web.alarm.vo.Rule) Application(com.navercorp.pinpoint.web.vo.Application) ResponseTimeDataCollector(com.navercorp.pinpoint.batch.alarm.collector.ResponseTimeDataCollector) Test(org.junit.Test)

Aggregations

ResponseTimeDataCollector (com.navercorp.pinpoint.batch.alarm.collector.ResponseTimeDataCollector)12 Rule (com.navercorp.pinpoint.web.alarm.vo.Rule)12 Application (com.navercorp.pinpoint.web.vo.Application)11 Test (org.junit.Test)10 DataCollector (com.navercorp.pinpoint.batch.alarm.collector.DataCollector)2 AlarmChecker (com.navercorp.pinpoint.batch.alarm.checker.AlarmChecker)1 DataSourceConnectionUsageRateChecker (com.navercorp.pinpoint.batch.alarm.checker.DataSourceConnectionUsageRateChecker)1 DeadlockChecker (com.navercorp.pinpoint.batch.alarm.checker.DeadlockChecker)1 ErrorCountChecker (com.navercorp.pinpoint.batch.alarm.checker.ErrorCountChecker)1 ErrorCountToCalleeChecker (com.navercorp.pinpoint.batch.alarm.checker.ErrorCountToCalleeChecker)1 ErrorRateChecker (com.navercorp.pinpoint.batch.alarm.checker.ErrorRateChecker)1 ErrorRateToCalleeChecker (com.navercorp.pinpoint.batch.alarm.checker.ErrorRateToCalleeChecker)1 FileDescriptorChecker (com.navercorp.pinpoint.batch.alarm.checker.FileDescriptorChecker)1 HeapUsageRateChecker (com.navercorp.pinpoint.batch.alarm.checker.HeapUsageRateChecker)1 JvmCpuUsageRateChecker (com.navercorp.pinpoint.batch.alarm.checker.JvmCpuUsageRateChecker)1 ResponseCountChecker (com.navercorp.pinpoint.batch.alarm.checker.ResponseCountChecker)1 SlowCountChecker (com.navercorp.pinpoint.batch.alarm.checker.SlowCountChecker)1 SlowCountToCalleeChecker (com.navercorp.pinpoint.batch.alarm.checker.SlowCountToCalleeChecker)1 SlowRateChecker (com.navercorp.pinpoint.batch.alarm.checker.SlowRateChecker)1 SlowRateToCalleeChecker (com.navercorp.pinpoint.batch.alarm.checker.SlowRateToCalleeChecker)1