Merge branch 'feature/graphql-ui' of https://github.com/peng-yongsheng/incubator-skywalking into feature/graphql-ui
This commit is contained in:
commit
f0c2be4346
|
|
@ -24,6 +24,7 @@ import org.apache.skywalking.apm.collector.storage.base.dao.DAO;
|
|||
import org.apache.skywalking.apm.collector.storage.table.MetricSource;
|
||||
import org.apache.skywalking.apm.collector.storage.ui.common.Node;
|
||||
import org.apache.skywalking.apm.collector.storage.ui.common.Step;
|
||||
import org.apache.skywalking.apm.collector.storage.ui.service.ServiceMetric;
|
||||
import org.apache.skywalking.apm.collector.storage.utils.DurationPoint;
|
||||
|
||||
/**
|
||||
|
|
@ -36,4 +37,7 @@ public interface IServiceMetricUIDAO extends DAO {
|
|||
|
||||
List<Node> getServicesMetric(Step step, long startTime, long endTime,
|
||||
MetricSource metricSource, Collection<Integer> serviceIds);
|
||||
|
||||
List<ServiceMetric> getSlowService(int applicationId, Step step, long start, long end,
|
||||
Integer top, MetricSource metricSource);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ import java.util.List;
|
|||
*/
|
||||
public class Alarm {
|
||||
private List<AlarmItem> items;
|
||||
private Integer count;
|
||||
private int total;
|
||||
|
||||
public List<AlarmItem> getItems() {
|
||||
return items;
|
||||
|
|
@ -35,11 +35,11 @@ public class Alarm {
|
|||
this.items = items;
|
||||
}
|
||||
|
||||
public Integer getCount() {
|
||||
return count;
|
||||
public int getTotal() {
|
||||
return total;
|
||||
}
|
||||
|
||||
public void setCount(Integer count) {
|
||||
this.count = count;
|
||||
public void setTotal(int total) {
|
||||
this.total = total;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,6 +25,6 @@ public class AlarmItem {
|
|||
private String title;
|
||||
private String content;
|
||||
private String startTime;
|
||||
private AlarmType alertType;
|
||||
private AlarmType alarmType;
|
||||
private CauseType causeType;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,61 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
package org.apache.skywalking.apm.collector.storage.ui.service;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public class ServiceMetric {
|
||||
private int id;
|
||||
private String name;
|
||||
private int avgResponseTime;
|
||||
private int tps;
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public int getAvgResponseTime() {
|
||||
return avgResponseTime;
|
||||
}
|
||||
|
||||
public void setAvgResponseTime(int avgResponseTime) {
|
||||
this.avgResponseTime = avgResponseTime;
|
||||
}
|
||||
|
||||
public int getTps() {
|
||||
return tps;
|
||||
}
|
||||
|
||||
public void setTps(int tps) {
|
||||
this.tps = tps;
|
||||
}
|
||||
}
|
||||
|
|
@ -160,7 +160,7 @@ public class InstanceEsUIDAO extends EsDAO implements IInstanceUIDAO {
|
|||
BoolQueryBuilder boolQuery = QueryBuilders.boolQuery();
|
||||
boolQuery.must().add(QueryBuilders.rangeQuery(InstanceTable.COLUMN_HEARTBEAT_TIME).gte(start).lte(end));
|
||||
if (StringUtils.isNotEmpty(keyword)) {
|
||||
boolQuery.must().add(QueryBuilders.termQuery(InstanceTable.COLUMN_OS_INFO, keyword));
|
||||
boolQuery.must().add(QueryBuilders.queryStringQuery(keyword));
|
||||
}
|
||||
boolQuery.must().add(QueryBuilders.termQuery(InstanceTable.COLUMN_IS_ADDRESS, BooleanUtils.FALSE));
|
||||
searchRequestBuilder.setQuery(boolQuery);
|
||||
|
|
|
|||
|
|
@ -19,8 +19,10 @@
|
|||
package org.apache.skywalking.apm.collector.storage.es.dao.ui;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import org.apache.skywalking.apm.collector.client.elasticsearch.ElasticSearchClient;
|
||||
import org.apache.skywalking.apm.collector.core.util.Const;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.ui.IServiceMetricUIDAO;
|
||||
|
|
@ -29,6 +31,7 @@ import org.apache.skywalking.apm.collector.storage.table.MetricSource;
|
|||
import org.apache.skywalking.apm.collector.storage.table.service.ServiceMetricTable;
|
||||
import org.apache.skywalking.apm.collector.storage.ui.common.Node;
|
||||
import org.apache.skywalking.apm.collector.storage.ui.common.Step;
|
||||
import org.apache.skywalking.apm.collector.storage.ui.service.ServiceMetric;
|
||||
import org.apache.skywalking.apm.collector.storage.ui.service.ServiceNode;
|
||||
import org.apache.skywalking.apm.collector.storage.utils.DurationPoint;
|
||||
import org.apache.skywalking.apm.collector.storage.utils.TimePyramidTableNameBuilder;
|
||||
|
|
@ -40,16 +43,21 @@ import org.elasticsearch.action.search.SearchResponse;
|
|||
import org.elasticsearch.action.search.SearchType;
|
||||
import org.elasticsearch.index.query.BoolQueryBuilder;
|
||||
import org.elasticsearch.index.query.QueryBuilders;
|
||||
import org.elasticsearch.script.Script;
|
||||
import org.elasticsearch.search.aggregations.AggregationBuilders;
|
||||
import org.elasticsearch.search.aggregations.bucket.terms.Terms;
|
||||
import org.elasticsearch.search.aggregations.bucket.terms.TermsAggregationBuilder;
|
||||
import org.elasticsearch.search.aggregations.metrics.sum.Sum;
|
||||
import org.elasticsearch.search.aggregations.pipeline.InternalSimpleValue;
|
||||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregatorBuilders;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public class ServiceMetricEsUIDAO extends EsDAO implements IServiceMetricUIDAO {
|
||||
|
||||
private static final String AVG_DURATION = "avg_duration";
|
||||
|
||||
public ServiceMetricEsUIDAO(ElasticSearchClient client) {
|
||||
super(client);
|
||||
}
|
||||
|
|
@ -143,4 +151,58 @@ public class ServiceMetricEsUIDAO extends EsDAO implements IServiceMetricUIDAO {
|
|||
});
|
||||
return nodes;
|
||||
}
|
||||
|
||||
@Override public List<ServiceMetric> getSlowService(int applicationId, Step step, long start, long end, Integer top,
|
||||
MetricSource metricSource) {
|
||||
String tableName = TimePyramidTableNameBuilder.build(step, ServiceMetricTable.TABLE);
|
||||
|
||||
SearchRequestBuilder searchRequestBuilder = getClient().prepareSearch(tableName);
|
||||
searchRequestBuilder.setTypes(ServiceMetricTable.TABLE_TYPE);
|
||||
searchRequestBuilder.setSearchType(SearchType.DFS_QUERY_THEN_FETCH);
|
||||
|
||||
BoolQueryBuilder boolQuery = QueryBuilders.boolQuery();
|
||||
boolQuery.must().add(QueryBuilders.rangeQuery(ServiceMetricTable.COLUMN_TIME_BUCKET).gte(start).lte(end));
|
||||
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(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));
|
||||
aggregationBuilder.subAggregation(AggregationBuilders.sum(ServiceMetricTable.COLUMN_TRANSACTION_ERROR_DURATION_SUM).field(ServiceMetricTable.COLUMN_TRANSACTION_ERROR_DURATION_SUM));
|
||||
|
||||
Map<String, String> bucketsPathsMap = new HashMap<>();
|
||||
bucketsPathsMap.put(ServiceMetricTable.COLUMN_TRANSACTION_CALLS, ServiceMetricTable.COLUMN_TRANSACTION_CALLS);
|
||||
bucketsPathsMap.put(ServiceMetricTable.COLUMN_TRANSACTION_ERROR_CALLS, ServiceMetricTable.COLUMN_TRANSACTION_ERROR_CALLS);
|
||||
bucketsPathsMap.put(ServiceMetricTable.COLUMN_TRANSACTION_DURATION_SUM, ServiceMetricTable.COLUMN_TRANSACTION_DURATION_SUM);
|
||||
bucketsPathsMap.put(ServiceMetricTable.COLUMN_TRANSACTION_ERROR_DURATION_SUM, ServiceMetricTable.COLUMN_TRANSACTION_ERROR_DURATION_SUM);
|
||||
|
||||
String idOrCode = "(params." + ServiceMetricTable.COLUMN_TRANSACTION_DURATION_SUM + " - params." + ServiceMetricTable.COLUMN_TRANSACTION_ERROR_DURATION_SUM + ")"
|
||||
+ " / "
|
||||
+ "(params." + ServiceMetricTable.COLUMN_TRANSACTION_CALLS + " - params." + ServiceMetricTable.COLUMN_TRANSACTION_ERROR_CALLS + ")";
|
||||
Script script = new Script(idOrCode);
|
||||
aggregationBuilder.subAggregation(PipelineAggregatorBuilders.bucketScript(AVG_DURATION, bucketsPathsMap, script));
|
||||
|
||||
searchRequestBuilder.addAggregation(aggregationBuilder);
|
||||
SearchResponse searchResponse = searchRequestBuilder.execute().actionGet();
|
||||
|
||||
List<ServiceMetric> serviceMetrics = new LinkedList<>();
|
||||
Terms serviceIdTerms = searchResponse.getAggregations().get(ServiceMetricTable.COLUMN_SERVICE_ID);
|
||||
serviceIdTerms.getBuckets().forEach(serviceIdTerm -> {
|
||||
int serviceId = serviceIdTerm.getKeyAsNumber().intValue();
|
||||
|
||||
ServiceMetric serviceMetric = new ServiceMetric();
|
||||
InternalSimpleValue simpleValue = serviceIdTerm.getAggregations().get(AVG_DURATION);
|
||||
|
||||
serviceMetric.setId(serviceId);
|
||||
serviceMetric.setAvgResponseTime((int)simpleValue.getValue());
|
||||
serviceMetrics.add(serviceMetric);
|
||||
});
|
||||
return serviceMetrics;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ import org.apache.skywalking.apm.collector.storage.table.MetricSource;
|
|||
import org.apache.skywalking.apm.collector.storage.table.service.ServiceMetricTable;
|
||||
import org.apache.skywalking.apm.collector.storage.ui.common.Node;
|
||||
import org.apache.skywalking.apm.collector.storage.ui.common.Step;
|
||||
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.storage.utils.TimePyramidTableNameBuilder;
|
||||
import org.slf4j.Logger;
|
||||
|
|
@ -106,9 +107,13 @@ public class ServiceMetricH2UIDAO extends H2DAO implements IServiceMetricUIDAO {
|
|||
return trends;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Node> getServicesMetric(Step step, long startTime, long endTime, MetricSource metricSource,
|
||||
@Override public List<Node> getServicesMetric(Step step, long startTime, long endTime, MetricSource metricSource,
|
||||
Collection<Integer> serviceIds) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override public List<ServiceMetric> getSlowService(int applicationId, Step step, long start, long end, Integer top,
|
||||
MetricSource metricSource) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -110,8 +110,7 @@ public class GraphQLHandler extends JettyHandler {
|
|||
|
||||
JsonObject requestJson = gson.fromJson(request, JsonObject.class);
|
||||
|
||||
Type mapType = new TypeToken<Map<String, Object>>() {
|
||||
}.getType();
|
||||
Type mapType = new TypeToken<Map<String, Object>>() { }.getType();
|
||||
|
||||
return execute(requestJson.get(QUERY).getAsString(), gson.fromJson(requestJson.get(VARIABLES), mapType));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,9 +29,9 @@ import org.apache.skywalking.apm.collector.storage.ui.common.Pagination;
|
|||
*/
|
||||
public class AlarmQuery implements Query {
|
||||
|
||||
public Alarm loadAlertList(String keyword, AlarmType alarmType, Duration duration, Pagination pagination) {
|
||||
public Alarm loadAlarmList(String keyword, AlarmType alarmType, Duration duration, Pagination paging) {
|
||||
Alarm alarm = new Alarm();
|
||||
alarm.setCount(0);
|
||||
alarm.setTotal(0);
|
||||
return alarm;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ import org.apache.skywalking.apm.collector.storage.ui.application.Application;
|
|||
import org.apache.skywalking.apm.collector.storage.ui.common.Duration;
|
||||
import org.apache.skywalking.apm.collector.storage.ui.common.Topology;
|
||||
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.ApplicationService;
|
||||
import org.apache.skywalking.apm.collector.ui.service.ApplicationTopologyService;
|
||||
|
|
@ -73,8 +73,11 @@ public class ApplicationQuery implements Query {
|
|||
return getApplicationTopologyService().getApplicationTopology(duration.getStep(), applicationId, start, end);
|
||||
}
|
||||
|
||||
public List<ServiceInfo> getSlowService(int applicationId, Duration duration, Integer top) {
|
||||
return null;
|
||||
public List<ServiceMetric> getSlowService(int applicationId, Duration duration, Integer top) throws ParseException {
|
||||
long start = DurationUtils.INSTANCE.exchangeToTimeBucket(duration.getStart());
|
||||
long end = DurationUtils.INSTANCE.exchangeToTimeBucket(duration.getEnd());
|
||||
|
||||
return getApplicationService().getSlowService(applicationId, duration.getStep(), start, end, top);
|
||||
}
|
||||
|
||||
public List<AppServerInfo> getServerThroughput(int applicationId, Duration duration, Integer top) {
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -18,13 +18,19 @@
|
|||
|
||||
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.ApplicationCacheService;
|
||||
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.IInstanceUIDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.dao.ui.IServiceMetricUIDAO;
|
||||
import org.apache.skywalking.apm.collector.storage.table.MetricSource;
|
||||
import org.apache.skywalking.apm.collector.storage.ui.application.Application;
|
||||
import org.apache.skywalking.apm.collector.storage.ui.common.Step;
|
||||
import org.apache.skywalking.apm.collector.storage.ui.service.ServiceMetric;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
|
|
@ -32,11 +38,15 @@ import org.apache.skywalking.apm.collector.storage.ui.application.Application;
|
|||
public class ApplicationService {
|
||||
|
||||
private final IInstanceUIDAO instanceDAO;
|
||||
private final IServiceMetricUIDAO serviceMetricUIDAO;
|
||||
private final ApplicationCacheService applicationCacheService;
|
||||
private final ServiceNameCacheService serviceNameCacheService;
|
||||
|
||||
public ApplicationService(ModuleManager moduleManager) {
|
||||
this.instanceDAO = moduleManager.find(StorageModule.NAME).getService(IInstanceUIDAO.class);
|
||||
this.serviceMetricUIDAO = moduleManager.find(StorageModule.NAME).getService(IServiceMetricUIDAO.class);
|
||||
this.applicationCacheService = moduleManager.find(CacheModule.NAME).getService(ApplicationCacheService.class);
|
||||
this.serviceNameCacheService = moduleManager.find(CacheModule.NAME).getService(ServiceNameCacheService.class);
|
||||
}
|
||||
|
||||
public List<Application> getApplications(long startTime, long endTime, int... applicationIds) {
|
||||
|
|
@ -48,4 +58,15 @@ public class ApplicationService {
|
|||
});
|
||||
return applications;
|
||||
}
|
||||
|
||||
public List<ServiceMetric> getSlowService(int applicationId, Step step, long start, long end,
|
||||
Integer top) throws ParseException {
|
||||
List<ServiceMetric> slowServices = serviceMetricUIDAO.getSlowService(applicationId, step, start, end, top, MetricSource.Callee);
|
||||
slowServices.forEach(slowService -> {
|
||||
slowService.setName(serviceNameCacheService.get(slowService.getId()).getServiceName());
|
||||
//TODO
|
||||
slowService.setTps(1);
|
||||
});
|
||||
return slowServices;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,6 +43,6 @@ type Application {
|
|||
extend type Query {
|
||||
getAllApplication(duration: Duration!): [Application!]!
|
||||
getApplicationTopology(applicationId: ID!, duration: Duration!): Topology
|
||||
getSlowService(applicationId: ID!, duration: Duration!, top: Int!): [ServiceInfo!]!
|
||||
getSlowService(applicationId: ID!, duration: Duration!, top: Int!): [ServiceMetric!]!
|
||||
getServerThroughput(applicationId: ID!, duration: Duration!, top: Int!): [AppServerInfo!]!
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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