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);
}
}
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());
}
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());
}
Aggregations