use of com.navercorp.pinpoint.web.alarm.collector.DataCollector 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.collector.DataCollector in project pinpoint by naver.
the class ReaderTest method beforeClass.
@BeforeClass
public static void beforeClass() {
applicationIndexDao = new ApplicationIndexDao() {
@Override
public List<Application> selectAllApplicationNames() {
List<Application> apps = new LinkedList<Application>();
for (int i = 0; i < 7; i++) {
apps.add(new Application(APP_NAME + i, ServiceType.STAND_ALONE));
}
return apps;
}
@Override
public List<String> selectAgentIds(String applicationName) {
return null;
}
@Override
public void deleteApplicationName(String applicationName) {
}
@Override
public void deleteAgentIds(Map<String, List<String>> applicationAgentIdMap) {
}
@Override
public void deleteAgentId(String applicationName, String agentId) {
}
};
alarmService = new AlarmServiceImpl() {
private Map<String, Rule> ruleMap;
{
ruleMap = new HashMap<String, Rule>();
for (int i = 0; i <= 6; i++) {
ruleMap.put(APP_NAME + i, new Rule(APP_NAME + i, SERVICE_TYPE, CheckerCategory.SLOW_COUNT.getName(), 76, "testGroup", false, false, ""));
}
}
@Override
public List<Rule> selectRuleByApplicationId(String applicationId) {
List<Rule> rules = new LinkedList<Rule>();
rules.add(ruleMap.get(applicationId));
return rules;
}
};
dataCollectorFactory = new DataCollectorFactory() {
@Override
public DataCollector createDataCollector(CheckerCategory checker, Application application, long timeSlotEndTime) {
return new ResponseTimeDataCollector(DataCollectorCategory.RESPONSE_TIME, null, null, 0, 0);
}
};
}
Aggregations