use of com.navercorp.pinpoint.batch.alarm.checker.AlarmChecker in project pinpoint by naver.
the class AlarmWriterIsolationTest method whenSequenceCountIsEqualToTimingCountDoNotSendAlarm.
@Test
public void whenSequenceCountIsEqualToTimingCountDoNotSendAlarm() throws Exception {
// given
Rule rule = getRuleStub(APPLICATION_ID, RULE_ID);
AlarmChecker<Long> checker = getCheckerStub(rule, 1000L);
List<AlarmChecker<?>> checkers = new LinkedList<>();
checkers.add(checker);
mockingAlarmService(getBeforeCheckerStub(1, 1));
mockingAlarmMessageSender(checker);
// when
writer.write(checkers);
// then
verify(alarmMessageSender, times(0)).sendSms(checker, 1, null);
verify(alarmMessageSender, times(0)).sendEmail(checker, 1, null);
}
use of com.navercorp.pinpoint.batch.alarm.checker.AlarmChecker in project pinpoint by naver.
the class CheckerRegistry method setup.
private void setup() {
put(CheckerCategory.SLOW_COUNT, new AlarmCheckerFactory() {
@Override
public AlarmChecker<?> createChecker(DataCollector dataCollector, Rule rule) {
return new SlowCountChecker((ResponseTimeDataCollector) dataCollector, rule);
}
});
put(CheckerCategory.SLOW_RATE, new AlarmCheckerFactory() {
@Override
public AlarmChecker<?> createChecker(DataCollector dataCollector, Rule rule) {
return new SlowRateChecker((ResponseTimeDataCollector) dataCollector, rule);
}
});
put(CheckerCategory.ERROR_COUNT, new AlarmCheckerFactory() {
@Override
public AlarmChecker<?> createChecker(DataCollector dataCollector, Rule rule) {
return new ErrorCountChecker((ResponseTimeDataCollector) dataCollector, rule);
}
});
put(CheckerCategory.ERROR_RATE, new AlarmCheckerFactory() {
public AlarmChecker<?> createChecker(DataCollector dataCollector, Rule rule) {
return new ErrorRateChecker((ResponseTimeDataCollector) dataCollector, rule);
}
});
put(CheckerCategory.TOTAL_COUNT, new AlarmCheckerFactory() {
@Override
public AlarmChecker<?> createChecker(DataCollector dataCollector, Rule rule) {
return new ResponseCountChecker((ResponseTimeDataCollector) dataCollector, rule);
}
});
put(CheckerCategory.SLOW_COUNT_TO_CALLEE, new AlarmCheckerFactory() {
@Override
public AlarmChecker<?> createChecker(DataCollector dataCollector, Rule rule) {
return new SlowCountToCalleeChecker((MapStatisticsCallerDataCollector) dataCollector, rule);
}
});
put(CheckerCategory.SLOW_RATE_TO_CALLEE, new AlarmCheckerFactory() {
@Override
public AlarmChecker<?> createChecker(DataCollector dataCollector, Rule rule) {
return new SlowRateToCalleeChecker(dataCollector, rule);
}
});
put(CheckerCategory.ERROR_COUNT_TO_CALLEE, new AlarmCheckerFactory() {
@Override
public AlarmChecker<?> createChecker(DataCollector dataCollector, Rule rule) {
return new ErrorCountToCalleeChecker((MapStatisticsCallerDataCollector) dataCollector, rule);
}
});
put(CheckerCategory.ERROR_RATE_TO_CALLEE, new AlarmCheckerFactory() {
@Override
public AlarmChecker<?> createChecker(DataCollector dataCollector, Rule rule) {
return new ErrorRateToCalleeChecker(dataCollector, rule);
}
});
put(CheckerCategory.TOTAL_COUNT_TO_CALLEE, new AlarmCheckerFactory() {
@Override
public AlarmChecker<?> createChecker(DataCollector dataCollector, Rule rule) {
return new TotalCountToCalleeChecker((MapStatisticsCallerDataCollector) dataCollector, rule);
}
});
put(CheckerCategory.HEAP_USAGE_RATE, new AlarmCheckerFactory() {
@Override
public AlarmChecker<?> createChecker(DataCollector dataCollector, Rule rule) {
return new HeapUsageRateChecker((AgentStatDataCollector) dataCollector, rule);
}
});
// put(CheckerCategory.GC_COUNT, new AlarmCheckerFactory() {
// @Override
// public AlarmChecker<?> createChecker(DataCollector dataCollector, Rule rule) {
// return new GcCountChecker((AgentStatDataCollector)dataCollector, rule);
// }
// });
put(CheckerCategory.JVM_CPU_USAGE_RATE, new AlarmCheckerFactory() {
@Override
public AlarmChecker<?> createChecker(DataCollector dataCollector, Rule rule) {
return new JvmCpuUsageRateChecker((AgentStatDataCollector) dataCollector, rule);
}
});
put(CheckerCategory.SYSTEM_CPU_USAGE_RATE, new AlarmCheckerFactory() {
@Override
public AlarmChecker<?> createChecker(DataCollector dataCollector, Rule rule) {
return new SystemCpuUsageRateChecker((AgentStatDataCollector) dataCollector, rule);
}
});
put(CheckerCategory.DATASOURCE_CONNECTION_USAGE_RATE, new AlarmCheckerFactory() {
@Override
public AlarmChecker<?> createChecker(DataCollector dataCollector, Rule rule) {
return new DataSourceConnectionUsageRateChecker((DataSourceDataCollector) dataCollector, rule);
}
});
put(CheckerCategory.DEADLOCK_OCCURRENCE, new AlarmCheckerFactory() {
@Override
public AlarmChecker<?> createChecker(DataCollector dataCollector, Rule rule) {
return new DeadlockChecker((AgentEventDataCollector) dataCollector, rule);
}
});
put(CheckerCategory.FILE_DESCRIPTOR_COUNT, new AlarmCheckerFactory() {
@Override
public AlarmChecker<?> createChecker(DataCollector dataCollector, Rule rule) {
return new FileDescriptorChecker((FileDescriptorDataCollector) dataCollector, rule);
}
});
}
use of com.navercorp.pinpoint.batch.alarm.checker.AlarmChecker in project pinpoint by naver.
the class AlarmWriterTest method smsSendTest.
@Ignore
@Test
public void smsSendTest() throws Exception {
Rule rule = new Rule("testService", "tomcat", CheckerCategory.SLOW_COUNT.getName(), 100, "testGroup", true, false, false, "");
SlowCountChecker checker = new SlowCountChecker(null, rule) {
@Override
public boolean isDetected() {
return true;
}
@Override
protected Long getDetectedValue() {
return 10000L;
}
};
List<AlarmChecker<?>> checkers = new LinkedList<>();
checkers.add(checker);
writer.write(checkers);
}
use of com.navercorp.pinpoint.batch.alarm.checker.AlarmChecker in project pinpoint by naver.
the class AlarmWriterTest method emailSendTest.
@Ignore
@Test
public void emailSendTest() throws Exception {
Rule rule = new Rule("testService", "tomcat", CheckerCategory.SLOW_COUNT.getName(), 100, "testGroup", false, true, false, "");
SlowCountChecker checker = new SlowCountChecker(null, rule) {
@Override
public boolean isDetected() {
return true;
}
@Override
protected Long getDetectedValue() {
return 10000L;
}
};
List<AlarmChecker<?>> checkers = new LinkedList<>();
checkers.add(checker);
writer.write(checkers);
}
use of com.navercorp.pinpoint.batch.alarm.checker.AlarmChecker in project pinpoint by naver.
the class AlarmWriterIsolationTest method whenSequenceCountIsLessThanTimingCountDoSendAlarm.
@Test
public void whenSequenceCountIsLessThanTimingCountDoSendAlarm() throws Exception {
// given
Rule rule = getRuleStub(APPLICATION_ID, RULE_ID);
AlarmChecker<Long> checker = getCheckerStub(rule, 1000L);
List<AlarmChecker<?>> checkers = new LinkedList<>();
checkers.add(checker);
mockingAlarmService(getBeforeCheckerStub(0, 1));
mockingAlarmMessageSender(checker);
// when
writer.write(checkers);
// then
verify(alarmMessageSender, times(1)).sendSms(checker, 1, null);
verify(alarmMessageSender, times(1)).sendEmail(checker, 1, null);
}
Aggregations