Search in sources :

Example 1 with SlowCountChecker

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

the class CheckerRegistry method setup.

private void setup() {
    put(CheckerCategory.SLOW_COUNT, new AlarmCheckerFactory() {

        @Override
        public AlarmChecker<?> createChecker(DataCollector dataCollector, Rule rule) {
            return new SlowCountChecker((ResponseTimeDataCollector) dataCollector, rule);
        }
    });
    put(CheckerCategory.SLOW_RATE, new AlarmCheckerFactory() {

        @Override
        public AlarmChecker<?> createChecker(DataCollector dataCollector, Rule rule) {
            return new SlowRateChecker((ResponseTimeDataCollector) dataCollector, rule);
        }
    });
    put(CheckerCategory.ERROR_COUNT, new AlarmCheckerFactory() {

        @Override
        public AlarmChecker<?> createChecker(DataCollector dataCollector, Rule rule) {
            return new ErrorCountChecker((ResponseTimeDataCollector) dataCollector, rule);
        }
    });
    put(CheckerCategory.ERROR_RATE, new AlarmCheckerFactory() {

        public AlarmChecker<?> createChecker(DataCollector dataCollector, Rule rule) {
            return new ErrorRateChecker((ResponseTimeDataCollector) dataCollector, rule);
        }
    });
    put(CheckerCategory.TOTAL_COUNT, new AlarmCheckerFactory() {

        @Override
        public AlarmChecker<?> createChecker(DataCollector dataCollector, Rule rule) {
            return new ResponseCountChecker((ResponseTimeDataCollector) dataCollector, rule);
        }
    });
    put(CheckerCategory.SLOW_COUNT_TO_CALLEE, new AlarmCheckerFactory() {

        @Override
        public AlarmChecker<?> createChecker(DataCollector dataCollector, Rule rule) {
            return new SlowCountToCalleeChecker((MapStatisticsCallerDataCollector) dataCollector, rule);
        }
    });
    put(CheckerCategory.SLOW_RATE_TO_CALLEE, new AlarmCheckerFactory() {

        @Override
        public AlarmChecker<?> createChecker(DataCollector dataCollector, Rule rule) {
            return new SlowRateToCalleeChecker(dataCollector, rule);
        }
    });
    put(CheckerCategory.ERROR_COUNT_TO_CALLEE, new AlarmCheckerFactory() {

        @Override
        public AlarmChecker<?> createChecker(DataCollector dataCollector, Rule rule) {
            return new ErrorCountToCalleeChecker((MapStatisticsCallerDataCollector) dataCollector, rule);
        }
    });
    put(CheckerCategory.ERROR_RATE_TO_CALLEE, new AlarmCheckerFactory() {

        @Override
        public AlarmChecker<?> createChecker(DataCollector dataCollector, Rule rule) {
            return new ErrorRateToCalleeChecker(dataCollector, rule);
        }
    });
    put(CheckerCategory.TOTAL_COUNT_TO_CALLEE, new AlarmCheckerFactory() {

        @Override
        public AlarmChecker<?> createChecker(DataCollector dataCollector, Rule rule) {
            return new TotalCountToCalleeChecker((MapStatisticsCallerDataCollector) dataCollector, rule);
        }
    });
    put(CheckerCategory.HEAP_USAGE_RATE, new AlarmCheckerFactory() {

        @Override
        public AlarmChecker<?> createChecker(DataCollector dataCollector, Rule rule) {
            return new HeapUsageRateChecker((AgentStatDataCollector) dataCollector, rule);
        }
    });
    // put(CheckerCategory.GC_COUNT, new AlarmCheckerFactory() {
    // @Override
    // public AlarmChecker<?> createChecker(DataCollector dataCollector, Rule rule) {
    // return new GcCountChecker((AgentStatDataCollector)dataCollector, rule);
    // }
    // });
    put(CheckerCategory.JVM_CPU_USAGE_RATE, new AlarmCheckerFactory() {

        @Override
        public AlarmChecker<?> createChecker(DataCollector dataCollector, Rule rule) {
            return new JvmCpuUsageRateChecker((AgentStatDataCollector) dataCollector, rule);
        }
    });
    put(CheckerCategory.SYSTEM_CPU_USAGE_RATE, new AlarmCheckerFactory() {

        @Override
        public AlarmChecker<?> createChecker(DataCollector dataCollector, Rule rule) {
            return new SystemCpuUsageRateChecker((AgentStatDataCollector) dataCollector, rule);
        }
    });
    put(CheckerCategory.DATASOURCE_CONNECTION_USAGE_RATE, new AlarmCheckerFactory() {

        @Override
        public AlarmChecker<?> createChecker(DataCollector dataCollector, Rule rule) {
            return new DataSourceConnectionUsageRateChecker((DataSourceDataCollector) dataCollector, rule);
        }
    });
    put(CheckerCategory.DEADLOCK_OCCURRENCE, new AlarmCheckerFactory() {

        @Override
        public AlarmChecker<?> createChecker(DataCollector dataCollector, Rule rule) {
            return new DeadlockChecker((AgentEventDataCollector) dataCollector, rule);
        }
    });
    put(CheckerCategory.FILE_DESCRIPTOR_COUNT, new AlarmCheckerFactory() {

        @Override
        public AlarmChecker<?> createChecker(DataCollector dataCollector, Rule rule) {
            return new FileDescriptorChecker((FileDescriptorDataCollector) dataCollector, rule);
        }
    });
}
Also used : JvmCpuUsageRateChecker(com.navercorp.pinpoint.batch.alarm.checker.JvmCpuUsageRateChecker) SlowCountToCalleeChecker(com.navercorp.pinpoint.batch.alarm.checker.SlowCountToCalleeChecker) ResponseCountChecker(com.navercorp.pinpoint.batch.alarm.checker.ResponseCountChecker) MapStatisticsCallerDataCollector(com.navercorp.pinpoint.batch.alarm.collector.MapStatisticsCallerDataCollector) DataSourceDataCollector(com.navercorp.pinpoint.batch.alarm.collector.DataSourceDataCollector) FileDescriptorDataCollector(com.navercorp.pinpoint.batch.alarm.collector.FileDescriptorDataCollector) ErrorRateToCalleeChecker(com.navercorp.pinpoint.batch.alarm.checker.ErrorRateToCalleeChecker) ResponseTimeDataCollector(com.navercorp.pinpoint.batch.alarm.collector.ResponseTimeDataCollector) SlowRateToCalleeChecker(com.navercorp.pinpoint.batch.alarm.checker.SlowRateToCalleeChecker) HeapUsageRateChecker(com.navercorp.pinpoint.batch.alarm.checker.HeapUsageRateChecker) FileDescriptorChecker(com.navercorp.pinpoint.batch.alarm.checker.FileDescriptorChecker) AgentStatDataCollector(com.navercorp.pinpoint.batch.alarm.collector.AgentStatDataCollector) SystemCpuUsageRateChecker(com.navercorp.pinpoint.batch.alarm.checker.SystemCpuUsageRateChecker) TotalCountToCalleeChecker(com.navercorp.pinpoint.batch.alarm.checker.TotalCountToCalleeChecker) SlowCountChecker(com.navercorp.pinpoint.batch.alarm.checker.SlowCountChecker) SlowRateChecker(com.navercorp.pinpoint.batch.alarm.checker.SlowRateChecker) AgentStatDataCollector(com.navercorp.pinpoint.batch.alarm.collector.AgentStatDataCollector) DataSourceDataCollector(com.navercorp.pinpoint.batch.alarm.collector.DataSourceDataCollector) MapStatisticsCallerDataCollector(com.navercorp.pinpoint.batch.alarm.collector.MapStatisticsCallerDataCollector) ResponseTimeDataCollector(com.navercorp.pinpoint.batch.alarm.collector.ResponseTimeDataCollector) DataCollector(com.navercorp.pinpoint.batch.alarm.collector.DataCollector) AgentEventDataCollector(com.navercorp.pinpoint.batch.alarm.collector.AgentEventDataCollector) FileDescriptorDataCollector(com.navercorp.pinpoint.batch.alarm.collector.FileDescriptorDataCollector) DataSourceConnectionUsageRateChecker(com.navercorp.pinpoint.batch.alarm.checker.DataSourceConnectionUsageRateChecker) DeadlockChecker(com.navercorp.pinpoint.batch.alarm.checker.DeadlockChecker) ErrorRateChecker(com.navercorp.pinpoint.batch.alarm.checker.ErrorRateChecker) ErrorCountChecker(com.navercorp.pinpoint.batch.alarm.checker.ErrorCountChecker) ErrorCountToCalleeChecker(com.navercorp.pinpoint.batch.alarm.checker.ErrorCountToCalleeChecker) AgentEventDataCollector(com.navercorp.pinpoint.batch.alarm.collector.AgentEventDataCollector) Rule(com.navercorp.pinpoint.web.alarm.vo.Rule) AlarmChecker(com.navercorp.pinpoint.batch.alarm.checker.AlarmChecker)

Example 2 with SlowCountChecker

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

the class AlarmWriterTest method smsSendTest.

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

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

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

Example 3 with SlowCountChecker

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

the class AlarmWriterTest method emailSendTest.

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

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

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

Example 4 with SlowCountChecker

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

the class CheckerCategoryTest method createCheckerTest.

@Test
public void createCheckerTest() {
    CheckerCategory slowCount = CheckerCategory.getValue("slow count");
    AlarmCheckerFactory checkerFactory = registry.getCheckerFactory(slowCount);
    Rule rule = new Rule(null, "", CheckerCategory.SLOW_COUNT.getName(), 75, "testGroup", false, false, false, "");
    SlowCountChecker checker = (SlowCountChecker) checkerFactory.createChecker(null, rule);
    rule = new Rule(null, "", CheckerCategory.SLOW_COUNT.getName(), 63, "testGroup", false, false, false, "");
    SlowCountChecker checker2 = (SlowCountChecker) checkerFactory.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.batch.alarm.checker.SlowCountChecker) Rule(com.navercorp.pinpoint.web.alarm.vo.Rule) Test(org.junit.Test)

Aggregations

SlowCountChecker (com.navercorp.pinpoint.batch.alarm.checker.SlowCountChecker)4 Rule (com.navercorp.pinpoint.web.alarm.vo.Rule)4 AlarmChecker (com.navercorp.pinpoint.batch.alarm.checker.AlarmChecker)3 Test (org.junit.Test)3 LinkedList (java.util.LinkedList)2 Ignore (org.junit.Ignore)2 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 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 SystemCpuUsageRateChecker (com.navercorp.pinpoint.batch.alarm.checker.SystemCpuUsageRateChecker)1