use of com.navercorp.pinpoint.web.alarm.checker.AlarmChecker 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);
}
}
use of com.navercorp.pinpoint.web.alarm.checker.AlarmChecker in project pinpoint by naver.
the class WriterTest method emailSendTest.
@Ignore
@Test
public void emailSendTest() throws Exception {
Rule rule = new Rule("testService", "tomcat", CheckerCategory.SLOW_COUNT.getName(), 100, "testGroup", false, true, "");
SlowCountChecker checker = new SlowCountChecker(null, rule) {
@Override
public boolean isDetected() {
return true;
}
@Override
protected long getDetectedValue() {
return 10000;
}
};
List<AlarmChecker> checkers = new LinkedList<AlarmChecker>();
checkers.add(checker);
writer.write(checkers);
}
use of com.navercorp.pinpoint.web.alarm.checker.AlarmChecker in project pinpoint by naver.
the class WriterTest method smsSendTest.
@Ignore
@Test
public void smsSendTest() throws Exception {
Rule rule = new Rule("testService", "tomcat", CheckerCategory.SLOW_COUNT.getName(), 100, "testGroup", true, false, "");
SlowCountChecker checker = new SlowCountChecker(null, rule) {
@Override
public boolean isDetected() {
return true;
}
@Override
protected long getDetectedValue() {
return 10000;
}
};
List<AlarmChecker> checkers = new LinkedList<AlarmChecker>();
checkers.add(checker);
writer.write(checkers);
}
use of com.navercorp.pinpoint.web.alarm.checker.AlarmChecker 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);
}
}
Aggregations