Search in sources :

Example 1 with ConjecturalApp

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;
}
Also used : ConjecturalAppBrief(org.apache.skywalking.apm.collector.storage.ui.overview.ConjecturalAppBrief) ConjecturalApp(org.apache.skywalking.apm.collector.storage.ui.overview.ConjecturalApp)

Example 2 with ConjecturalApp

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;
}
Also used : TermsAggregationBuilder(org.elasticsearch.search.aggregations.bucket.terms.TermsAggregationBuilder) SearchRequestBuilder(org.elasticsearch.action.search.SearchRequestBuilder) Terms(org.elasticsearch.search.aggregations.bucket.terms.Terms) ConjecturalApp(org.apache.skywalking.apm.collector.storage.ui.overview.ConjecturalApp) LinkedList(java.util.LinkedList) SearchResponse(org.elasticsearch.action.search.SearchResponse)

Aggregations

ConjecturalApp (org.apache.skywalking.apm.collector.storage.ui.overview.ConjecturalApp)2 LinkedList (java.util.LinkedList)1 ConjecturalAppBrief (org.apache.skywalking.apm.collector.storage.ui.overview.ConjecturalAppBrief)1 SearchRequestBuilder (org.elasticsearch.action.search.SearchRequestBuilder)1 SearchResponse (org.elasticsearch.action.search.SearchResponse)1 Terms (org.elasticsearch.search.aggregations.bucket.terms.Terms)1 TermsAggregationBuilder (org.elasticsearch.search.aggregations.bucket.terms.TermsAggregationBuilder)1