Search in sources :

Example 16 with DurationPoint

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;
}
Also used : ResponseTimeTrend(org.apache.skywalking.apm.collector.storage.ui.common.ResponseTimeTrend) DurationPoint(org.apache.skywalking.apm.collector.storage.utils.DurationPoint)

Example 17 with DurationPoint

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;
}
Also used : HashMap(java.util.HashMap) DurationPoint(org.apache.skywalking.apm.collector.storage.utils.DurationPoint) Application(org.apache.skywalking.apm.collector.storage.ui.application.Application) AlarmTrend(org.apache.skywalking.apm.collector.storage.ui.overview.AlarmTrend)

Aggregations

DurationPoint (org.apache.skywalking.apm.collector.storage.utils.DurationPoint)17 ElasticSearchClient (org.apache.skywalking.apm.collector.client.elasticsearch.ElasticSearchClient)8 MultiGetItemResponse (org.elasticsearch.action.get.MultiGetItemResponse)8 MultiGetRequestBuilder (org.elasticsearch.action.get.MultiGetRequestBuilder)8 MultiGetResponse (org.elasticsearch.action.get.MultiGetResponse)8 LinkedList (java.util.LinkedList)4 ResponseTimeTrend (org.apache.skywalking.apm.collector.storage.ui.common.ResponseTimeTrend)2 ThroughputTrend (org.apache.skywalking.apm.collector.storage.ui.common.ThroughputTrend)2 HashMap (java.util.HashMap)1 IMemoryMetricUIDAO (org.apache.skywalking.apm.collector.storage.dao.ui.IMemoryMetricUIDAO)1 Application (org.apache.skywalking.apm.collector.storage.ui.application.Application)1 SLATrend (org.apache.skywalking.apm.collector.storage.ui.common.SLATrend)1 AlarmTrend (org.apache.skywalking.apm.collector.storage.ui.overview.AlarmTrend)1 CPUTrend (org.apache.skywalking.apm.collector.storage.ui.server.CPUTrend)1 GCTrend (org.apache.skywalking.apm.collector.storage.ui.server.GCTrend)1 MemoryTrend (org.apache.skywalking.apm.collector.storage.ui.server.MemoryTrend)1