Search in sources :

Example 1 with CheckerCategory

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

the class AlarmReader method addChecker.

private void addChecker(Application application) {
    List<Rule> rules = alarmService.selectRuleByApplicationId(application.getName());
    long timeSlotEndTime = System.currentTimeMillis();
    Map<DataCollectorCategory, DataCollector> collectorMap = new HashMap<>();
    for (Rule rule : rules) {
        CheckerCategory checkerCategory = CheckerCategory.getValue(rule.getCheckerName());
        AlarmCheckerFactory factory = checkerRegistry.getCheckerFactory(checkerCategory);
        DataCollector collector = collectorMap.get(checkerCategory.getDataCollectorCategory());
        if (collector == null) {
            collector = dataCollectorFactory.createDataCollector(checkerCategory, application, timeSlotEndTime);
            collectorMap.put(collector.getDataCollectorCategory(), collector);
        }
        AlarmChecker<?> checker = factory.createChecker(collector, rule);
        checkers.add(checker);
    }
}
Also used : CheckerCategory(com.navercorp.pinpoint.web.alarm.CheckerCategory) DataCollectorCategory(com.navercorp.pinpoint.web.alarm.DataCollectorCategory) Rule(com.navercorp.pinpoint.web.alarm.vo.Rule) DataCollector(com.navercorp.pinpoint.batch.alarm.collector.DataCollector)

Example 2 with CheckerCategory

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

use of com.navercorp.pinpoint.web.alarm.CheckerCategory 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

CheckerCategory (com.navercorp.pinpoint.web.alarm.CheckerCategory)3 Rule (com.navercorp.pinpoint.web.alarm.vo.Rule)3 Test (org.junit.Test)2 SlowCountChecker (com.navercorp.pinpoint.batch.alarm.checker.SlowCountChecker)1 DataCollector (com.navercorp.pinpoint.batch.alarm.collector.DataCollector)1 DataCollectorCategory (com.navercorp.pinpoint.web.alarm.DataCollectorCategory)1 SlowCountChecker (com.navercorp.pinpoint.web.alarm.checker.SlowCountChecker)1