use of org.apache.skywalking.apm.collector.storage.utils.DurationPoint in project incubator-skywalking by apache.
the class ServiceNameService method getServiceResponseTimeTrend.
public ResponseTimeTrend getServiceResponseTimeTrend(int serviceId, Step step, long startTimeBucket, long endTimeBucket) throws ParseException {
ResponseTimeTrend responseTimeTrend = new ResponseTimeTrend();
List<DurationPoint> durationPoints = DurationUtils.INSTANCE.getDurationPoints(step, startTimeBucket, endTimeBucket);
responseTimeTrend.setTrendList(serviceMetricUIDAO.getServiceResponseTimeTrend(serviceId, step, durationPoints));
return responseTimeTrend;
}
use of org.apache.skywalking.apm.collector.storage.utils.DurationPoint 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