Search in sources :

Example 1 with SlowCountChecker

use of com.navercorp.pinpoint.web.alarm.checker.SlowCountChecker in project pinpoint by naver.

the class WriterTest method emailSendTest.

@Ignore
@Test
public void emailSendTest() throws Exception {
    Rule rule = new Rule("testService", "tomcat", CheckerCategory.SLOW_COUNT.getName(), 100, "testGroup", false, true, "");
    SlowCountChecker checker = new SlowCountChecker(null, rule) {

        @Override
        public boolean isDetected() {
            return true;
        }

        @Override
        protected long getDetectedValue() {
            return 10000;
        }
    };
    List<AlarmChecker> checkers = new LinkedList<AlarmChecker>();
    checkers.add(checker);
    writer.write(checkers);
}
Also used : SlowCountChecker(com.navercorp.pinpoint.web.alarm.checker.SlowCountChecker) Rule(com.navercorp.pinpoint.web.alarm.vo.Rule) LinkedList(java.util.LinkedList) AlarmChecker(com.navercorp.pinpoint.web.alarm.checker.AlarmChecker) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 2 with SlowCountChecker

use of com.navercorp.pinpoint.web.alarm.checker.SlowCountChecker 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 3 with SlowCountChecker

use of com.navercorp.pinpoint.web.alarm.checker.SlowCountChecker in project pinpoint by naver.

the class CheckerCategoryTest method createCheckerTest.

@Test
public void createCheckerTest() {
    CheckerCategory slowCount = CheckerCategory.getValue("slow count");
    Rule rule = new Rule(null, "", CheckerCategory.SLOW_COUNT.getName(), 75, "testGroup", false, false, "");
    SlowCountChecker checker = (SlowCountChecker) slowCount.createChecker(null, rule);
    rule = new Rule(null, "", CheckerCategory.SLOW_COUNT.getName(), 63, "testGroup", false, false, "");
    SlowCountChecker checker2 = (SlowCountChecker) slowCount.createChecker(null, rule);
    assertNotSame(checker, checker2);
    assertNotNull(checker);
    assertEquals(75, (int) checker.getRule().getThreshold());
    assertNotNull(checker2);
    assertEquals(63, (int) checker2.getRule().getThreshold());
}
Also used : CheckerCategory(com.navercorp.pinpoint.web.alarm.CheckerCategory) SlowCountChecker(com.navercorp.pinpoint.web.alarm.checker.SlowCountChecker) Rule(com.navercorp.pinpoint.web.alarm.vo.Rule) Test(org.junit.Test)

Example 4 with SlowCountChecker

use of com.navercorp.pinpoint.web.alarm.checker.SlowCountChecker in project pinpoint by naver.

the class WriterTest method smsSendTest.

@Ignore
@Test
public void smsSendTest() throws Exception {
    Rule rule = new Rule("testService", "tomcat", CheckerCategory.SLOW_COUNT.getName(), 100, "testGroup", true, false, "");
    SlowCountChecker checker = new SlowCountChecker(null, rule) {

        @Override
        public boolean isDetected() {
            return true;
        }

        @Override
        protected long getDetectedValue() {
            return 10000;
        }
    };
    List<AlarmChecker> checkers = new LinkedList<AlarmChecker>();
    checkers.add(checker);
    writer.write(checkers);
}
Also used : SlowCountChecker(com.navercorp.pinpoint.web.alarm.checker.SlowCountChecker) Rule(com.navercorp.pinpoint.web.alarm.vo.Rule) LinkedList(java.util.LinkedList) AlarmChecker(com.navercorp.pinpoint.web.alarm.checker.AlarmChecker) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 5 with SlowCountChecker

use of com.navercorp.pinpoint.web.alarm.checker.SlowCountChecker in project pinpoint by naver.

the class SlowCountCheckerTest 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.SLOW_COUNT.getName(), 74, "testGroup", false, false, "");
    SlowCountChecker checker = new SlowCountChecker(collector, rule);
    checker.check();
    assertTrue(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)

Aggregations

SlowCountChecker (com.navercorp.pinpoint.web.alarm.checker.SlowCountChecker)5 Rule (com.navercorp.pinpoint.web.alarm.vo.Rule)5 Test (org.junit.Test)5 AlarmChecker (com.navercorp.pinpoint.web.alarm.checker.AlarmChecker)2 ResponseTimeDataCollector (com.navercorp.pinpoint.web.alarm.collector.ResponseTimeDataCollector)2 Application (com.navercorp.pinpoint.web.vo.Application)2 LinkedList (java.util.LinkedList)2 Ignore (org.junit.Ignore)2 CheckerCategory (com.navercorp.pinpoint.web.alarm.CheckerCategory)1