Search in sources :

Example 1 with CheckerResult

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

the class AlarmServiceImpl method selectBeforeCheckerResults.

@Override
public Map<String, CheckerResult> selectBeforeCheckerResults(String applicationId) {
    Map<String, CheckerResult> checkerResults = new HashMap<>();
    List<CheckerResult> CheckerResultList = alarmDao.selectBeforeCheckerResultList(applicationId);
    if (!CheckerResultList.isEmpty()) {
        for (CheckerResult checkerResult : CheckerResultList) {
            checkerResults.put(checkerResult.getCheckerName(), checkerResult);
        }
    }
    return checkerResults;
}
Also used : CheckerResult(com.navercorp.pinpoint.web.alarm.vo.CheckerResult) HashMap(java.util.HashMap)

Example 2 with CheckerResult

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

the class AlarmServiceImpl method updateBeforeCheckerResult.

@Override
public void updateBeforeCheckerResult(CheckerResult beforeCheckerResult, AlarmChecker checker) {
    alarmDao.deleteCheckerResult(beforeCheckerResult);
    if (checker.isDetected()) {
        beforeCheckerResult.setDetected(true);
        beforeCheckerResult.increseCount();
        alarmDao.insertCheckerResult(beforeCheckerResult);
    } else {
        alarmDao.insertCheckerResult(new CheckerResult(checker.getRule().getApplicationId(), checker.getRule().getCheckerName(), false, 0, 1));
    }
}
Also used : CheckerResult(com.navercorp.pinpoint.web.alarm.vo.CheckerResult)

Example 3 with CheckerResult

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

the class AlarmWriter method write.

@Override
public void write(List<? extends AlarmChecker> checkers) throws Exception {
    Map<String, CheckerResult> beforeCheckerResults = alarmService.selectBeforeCheckerResults(checkers.get(0).getRule().getApplicationId());
    for (AlarmChecker checker : checkers) {
        CheckerResult beforeCheckerResult = beforeCheckerResults.get(checker.getRule().getCheckerName());
        if (beforeCheckerResult == null) {
            beforeCheckerResult = new CheckerResult(checker.getRule().getApplicationId(), checker.getRule().getCheckerName(), false, 0, 1);
        }
        if (checker.isDetected()) {
            sendAlarmMessage(beforeCheckerResult, checker);
        }
        alarmService.updateBeforeCheckerResult(beforeCheckerResult, checker);
    }
}
Also used : CheckerResult(com.navercorp.pinpoint.web.alarm.vo.CheckerResult) AlarmChecker(com.navercorp.pinpoint.web.alarm.checker.AlarmChecker)

Aggregations

CheckerResult (com.navercorp.pinpoint.web.alarm.vo.CheckerResult)3 AlarmChecker (com.navercorp.pinpoint.web.alarm.checker.AlarmChecker)1 HashMap (java.util.HashMap)1