use of org.apache.skywalking.apm.collector.storage.ui.overview.AlarmTrend in project incubator-skywalking by apache.
the class AlarmService method getApplicationAlarmTrend.
public AlarmTrend getApplicationAlarmTrend(Step step, long startTimeBucket, long endTimeBucket, long startSecondTimeBucket, long endSecondTimeBucket) throws ParseException {
List<Application> applications = instanceDAO.getApplications(startSecondTimeBucket, endSecondTimeBucket);
List<DurationPoint> durationPoints = DurationUtils.INSTANCE.getDurationPoints(step, startTimeBucket, endTimeBucket);
List<IApplicationAlarmListUIDAO.AlarmTrend> alarmTrends = applicationAlarmListUIDAO.getAlarmedApplicationNum(step, startTimeBucket, endTimeBucket);
Map<Long, Integer> trendsMap = new HashMap<>();
alarmTrends.forEach(alarmTrend -> trendsMap.put(alarmTrend.getTimeBucket(), alarmTrend.getNumberOfApplication()));
AlarmTrend alarmTrend = new AlarmTrend();
durationPoints.forEach(durationPoint -> {
if (applications.size() == 0) {
alarmTrend.getNumOfAlarmRate().add(0);
} else {
alarmTrend.getNumOfAlarmRate().add((trendsMap.getOrDefault(durationPoint.getPoint(), 0) * 10000) / (applications.size()));
}
});
return alarmTrend;
}
Aggregations