Provide the overview/getTopNSlowService query.
This commit is contained in:
parent
7b2cb2e410
commit
425324ee46
|
|
@ -162,13 +162,15 @@ public class ServiceMetricEsUIDAO extends EsDAO implements IServiceMetricUIDAO {
|
|||
|
||||
BoolQueryBuilder boolQuery = QueryBuilders.boolQuery();
|
||||
boolQuery.must().add(QueryBuilders.rangeQuery(ServiceMetricTable.COLUMN_TIME_BUCKET).gte(start).lte(end));
|
||||
boolQuery.must().add(QueryBuilders.termQuery(ServiceMetricTable.COLUMN_APPLICATION_ID, applicationId));
|
||||
if (applicationId != 0) {
|
||||
boolQuery.must().add(QueryBuilders.termQuery(ServiceMetricTable.COLUMN_APPLICATION_ID, applicationId));
|
||||
}
|
||||
boolQuery.must().add(QueryBuilders.termQuery(ServiceMetricTable.COLUMN_SOURCE_VALUE, metricSource.getValue()));
|
||||
|
||||
searchRequestBuilder.setQuery(boolQuery);
|
||||
searchRequestBuilder.setSize(0);
|
||||
|
||||
TermsAggregationBuilder aggregationBuilder = AggregationBuilders.terms(ServiceMetricTable.COLUMN_SERVICE_ID).field(ServiceMetricTable.COLUMN_SERVICE_ID).size(100);
|
||||
TermsAggregationBuilder aggregationBuilder = AggregationBuilders.terms(ServiceMetricTable.COLUMN_SERVICE_ID).field(ServiceMetricTable.COLUMN_SERVICE_ID).size(top);
|
||||
aggregationBuilder.subAggregation(AggregationBuilders.sum(ServiceMetricTable.COLUMN_TRANSACTION_CALLS).field(ServiceMetricTable.COLUMN_TRANSACTION_CALLS));
|
||||
aggregationBuilder.subAggregation(AggregationBuilders.sum(ServiceMetricTable.COLUMN_TRANSACTION_ERROR_CALLS).field(ServiceMetricTable.COLUMN_TRANSACTION_ERROR_CALLS));
|
||||
aggregationBuilder.subAggregation(AggregationBuilders.sum(ServiceMetricTable.COLUMN_TRANSACTION_DURATION_SUM).field(ServiceMetricTable.COLUMN_TRANSACTION_DURATION_SUM));
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ import org.apache.skywalking.apm.collector.storage.ui.overview.AlarmTrend;
|
|||
import org.apache.skywalking.apm.collector.storage.ui.overview.ClusterBrief;
|
||||
import org.apache.skywalking.apm.collector.storage.ui.overview.ConjecturalAppBrief;
|
||||
import org.apache.skywalking.apm.collector.storage.ui.server.AppServerInfo;
|
||||
import org.apache.skywalking.apm.collector.storage.ui.service.ServiceInfo;
|
||||
import org.apache.skywalking.apm.collector.storage.ui.service.ServiceMetric;
|
||||
import org.apache.skywalking.apm.collector.ui.graphql.Query;
|
||||
import org.apache.skywalking.apm.collector.ui.service.AlarmService;
|
||||
import org.apache.skywalking.apm.collector.ui.service.ApplicationService;
|
||||
|
|
@ -118,8 +118,10 @@ public class OverViewLayerQuery implements Query {
|
|||
return null;
|
||||
}
|
||||
|
||||
public List<ServiceInfo> getTopNSlowService(Duration duration, int topN) {
|
||||
return null;
|
||||
public List<ServiceMetric> getTopNSlowService(Duration duration, int topN) throws ParseException {
|
||||
long start = DurationUtils.INSTANCE.exchangeToTimeBucket(duration.getStart());
|
||||
long end = DurationUtils.INSTANCE.exchangeToTimeBucket(duration.getEnd());
|
||||
return getServiceNameService().getSlowService(duration.getStep(), start, end, topN);
|
||||
}
|
||||
|
||||
public List<AppServerInfo> getTopNServerThroughput(Duration duration, int topN) {
|
||||
|
|
|
|||
|
|
@ -20,14 +20,18 @@ package org.apache.skywalking.apm.collector.ui.service;
|
|||
|
||||
import java.text.ParseException;
|
||||
import java.util.List;
|
||||
import org.apache.skywalking.apm.collector.cache.CacheModule;
|
||||
import org.apache.skywalking.apm.collector.cache.service.ServiceNameCacheService;
|
||||
import org.apache.skywalking.apm.collector.core.module.ModuleManager;
|
||||
import org.apache.skywalking.apm.collector.storage.StorageModule;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.ui.IServiceMetricUIDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.ui.IServiceNameServiceUIDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.table.MetricSource;
|
||||
import org.apache.skywalking.apm.collector.storage.ui.common.ResponseTimeTrend;
|
||||
import org.apache.skywalking.apm.collector.storage.ui.common.SLATrend;
|
||||
import org.apache.skywalking.apm.collector.storage.ui.common.Step;
|
||||
import org.apache.skywalking.apm.collector.storage.ui.service.ServiceInfo;
|
||||
import org.apache.skywalking.apm.collector.storage.ui.service.ServiceMetric;
|
||||
import org.apache.skywalking.apm.collector.storage.utils.DurationPoint;
|
||||
import org.apache.skywalking.apm.collector.ui.utils.DurationUtils;
|
||||
|
||||
|
|
@ -38,10 +42,12 @@ public class ServiceNameService {
|
|||
|
||||
private final IServiceNameServiceUIDAO serviceNameServiceUIDAO;
|
||||
private final IServiceMetricUIDAO serviceMetricUIDAO;
|
||||
private final ServiceNameCacheService serviceNameCacheService;
|
||||
|
||||
public ServiceNameService(ModuleManager moduleManager) {
|
||||
this.serviceNameServiceUIDAO = moduleManager.find(StorageModule.NAME).getService(IServiceNameServiceUIDAO.class);
|
||||
this.serviceMetricUIDAO = moduleManager.find(StorageModule.NAME).getService(IServiceMetricUIDAO.class);
|
||||
this.serviceNameCacheService = moduleManager.find(CacheModule.NAME).getService(ServiceNameCacheService.class);
|
||||
}
|
||||
|
||||
public int getCount() {
|
||||
|
|
@ -66,4 +72,15 @@ public class ServiceNameService {
|
|||
slaTrend.setTrendList(serviceMetricUIDAO.getServiceSLATrend(serviceId, step, durationPoints));
|
||||
return slaTrend;
|
||||
}
|
||||
|
||||
public List<ServiceMetric> getSlowService(Step step, long start, long end,
|
||||
Integer top) throws ParseException {
|
||||
List<ServiceMetric> slowServices = serviceMetricUIDAO.getSlowService(0, step, start, end, top, MetricSource.Callee);
|
||||
slowServices.forEach(slowService -> {
|
||||
slowService.setName(serviceNameCacheService.get(slowService.getId()).getServiceName());
|
||||
//TODO
|
||||
slowService.setTps(1);
|
||||
});
|
||||
return slowServices;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,6 +32,6 @@ extend type Query {
|
|||
getClusterBrief(duration: Duration!): ClusterBrief
|
||||
getAlarmTrend(duration: Duration!): AlarmTrend
|
||||
getConjecturalApps(duration: Duration!): ConjecturalAppBrief
|
||||
getTopNSlowService(duration: Duration!, topN: Int!): [ServiceInfo!]!
|
||||
getTopNSlowService(duration: Duration!, topN: Int!): [ServiceMetric!]!
|
||||
getTopNServerThroughput(duration: Duration!, topN: Int!): [AppServerInfo!]!
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue