Search in sources :

Example 1 with DataCollectorCategory

use of com.navercorp.pinpoint.web.alarm.DataCollectorFactory.DataCollectorCategory 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());
        DataCollector collector = collectorMap.get(checkerCategory.getDataCollectorCategory());
        if (collector == null) {
            collector = dataCollectorFactory.createDataCollector(checkerCategory, application, timeSlotEndTime);
            collectorMap.put(collector.getDataCollectorCategory(), collector);
        }
        AlarmChecker checker = checkerCategory.createChecker(collector, rule);
        checkers.add(checker);
    }
}
Also used : HashMap(java.util.HashMap) DataCollectorCategory(com.navercorp.pinpoint.web.alarm.DataCollectorFactory.DataCollectorCategory) Rule(com.navercorp.pinpoint.web.alarm.vo.Rule) DataCollector(com.navercorp.pinpoint.web.alarm.collector.DataCollector) AlarmChecker(com.navercorp.pinpoint.web.alarm.checker.AlarmChecker)

Aggregations

DataCollectorCategory (com.navercorp.pinpoint.web.alarm.DataCollectorFactory.DataCollectorCategory)1 AlarmChecker (com.navercorp.pinpoint.web.alarm.checker.AlarmChecker)1 DataCollector (com.navercorp.pinpoint.web.alarm.collector.DataCollector)1 Rule (com.navercorp.pinpoint.web.alarm.vo.Rule)1 HashMap (java.util.HashMap)1