use of org.apache.skywalking.apm.collector.storage.ui.overview.ConjecturalApp in project incubator-skywalking by apache.
the class ApplicationService method getConjecturalApps.
public ConjecturalAppBrief getConjecturalApps(Step step, long startSecondTimeBucket, long endSecondTimeBucket) throws ParseException {
List<ConjecturalApp> conjecturalApps = networkAddressUIDAO.getConjecturalApps();
conjecturalApps.forEach(conjecturalApp -> {
String serverType = ServerTypeDefine.getInstance().getServerType(conjecturalApp.getId());
conjecturalApp.setName(serverType);
});
ConjecturalAppBrief conjecturalAppBrief = new ConjecturalAppBrief();
conjecturalAppBrief.setApps(conjecturalApps);
return conjecturalAppBrief;
}
use of org.apache.skywalking.apm.collector.storage.ui.overview.ConjecturalApp in project incubator-skywalking by apache.
the class NetworkAddressEsUIDAO method getConjecturalApps.
@Override
public List<ConjecturalApp> getConjecturalApps() {
SearchRequestBuilder searchRequestBuilder = getClient().prepareSearch(NetworkAddressTable.TABLE);
searchRequestBuilder.setTypes(NetworkAddressTable.TABLE_TYPE);
searchRequestBuilder.setSearchType(SearchType.DFS_QUERY_THEN_FETCH);
int[] spanLayers = new int[] { SpanLayer.Database_VALUE, SpanLayer.Cache_VALUE, SpanLayer.MQ_VALUE };
searchRequestBuilder.setQuery(QueryBuilders.termsQuery(NetworkAddressTable.COLUMN_SPAN_LAYER, spanLayers));
searchRequestBuilder.setSize(0);
TermsAggregationBuilder aggregationBuilder = AggregationBuilders.terms(NetworkAddressTable.COLUMN_SERVER_TYPE).field(NetworkAddressTable.COLUMN_SERVER_TYPE).size(100);
searchRequestBuilder.addAggregation(aggregationBuilder);
SearchResponse searchResponse = searchRequestBuilder.execute().actionGet();
List<ConjecturalApp> conjecturalApps = new LinkedList<>();
Terms serverTypeTerms = searchResponse.getAggregations().get(NetworkAddressTable.COLUMN_SERVER_TYPE);
serverTypeTerms.getBuckets().forEach(serverTypeTerm -> {
int serverType = serverTypeTerm.getKeyAsNumber().intValue();
ConjecturalApp conjecturalApp = new ConjecturalApp();
conjecturalApp.setId(serverType);
conjecturalApp.setNum((int) serverTypeTerm.getDocCount());
conjecturalApps.add(conjecturalApp);
});
return conjecturalApps;
}
Aggregations