当前位置: 首页>>代码示例>>Java>>正文


Java NodesStatsRequest类代码示例

本文整理汇总了Java中org.elasticsearch.action.admin.cluster.node.stats.NodesStatsRequest的典型用法代码示例。如果您正苦于以下问题:Java NodesStatsRequest类的具体用法?Java NodesStatsRequest怎么用?Java NodesStatsRequest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


NodesStatsRequest类属于org.elasticsearch.action.admin.cluster.node.stats包,在下文中一共展示了NodesStatsRequest类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getNodeStats

import org.elasticsearch.action.admin.cluster.node.stats.NodesStatsRequest; //导入依赖的package包/类
private static CompletableFuture<NodeStats> getNodeStats(final Client client) {
    CompletableFuture<NodeStats> result = new CompletableFuture<>();

    NodesStatsRequest nodesStatsRequest = new NodesStatsRequest("_local").all();
    client.admin().cluster().nodesStats(nodesStatsRequest, new ActionListener<NodesStatsResponse>() {
        @Override
        public void onResponse(NodesStatsResponse nodesStatsResponse) {
            NodeStats stats = nodesStatsResponse.getNodes().get(0);
            result.complete(stats);
        }

        @Override
        public void onFailure(Exception e) {
            result.completeExceptionally(e);
        }
    });
    return result;
}
 
开发者ID:jsuchenia,项目名称:elasticsearch-prometheus-metrics,代码行数:19,代码来源:PrometheusExporterPlugin.java

示例2: doRequest

import org.elasticsearch.action.admin.cluster.node.stats.NodesStatsRequest; //导入依赖的package包/类
@Override
protected void doRequest(final RestRequest request, final RestChannel channel, final Client client) {

    final NodesStatsRequest nodesStatsRequest = new NodesStatsRequest("data:true");
    nodesStatsRequest.clear();
    nodesStatsRequest.indices(true);
    String[] fields = request.paramAsStringArray("fields", null);
    nodesStatsRequest.indices().fieldDataFields(fields == null ? new String[] {"*"} : fields);

    client.admin().cluster().nodesStats(nodesStatsRequest, new RestResponseListener<NodesStatsResponse>(channel) {
        @Override
        public RestResponse buildResponse(NodesStatsResponse nodeStatses) throws Exception {
            return RestTable.buildResponse(buildTable(request, nodeStatses), channel);
        }
    });
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:17,代码来源:RestFielddataAction.java

示例3: doCatRequest

import org.elasticsearch.action.admin.cluster.node.stats.NodesStatsRequest; //导入依赖的package包/类
@Override
public RestChannelConsumer doCatRequest(final RestRequest request, final NodeClient client) {
    final ClusterStateRequest clusterStateRequest = new ClusterStateRequest();
    clusterStateRequest.clear().nodes(true);
    clusterStateRequest.local(request.paramAsBoolean("local", clusterStateRequest.local()));
    clusterStateRequest.masterNodeTimeout(request.paramAsTime("master_timeout", clusterStateRequest.masterNodeTimeout()));
    final boolean fullId = request.paramAsBoolean("full_id", false);
    return channel -> client.admin().cluster().state(clusterStateRequest, new RestActionListener<ClusterStateResponse>(channel) {
        @Override
        public void processResponse(final ClusterStateResponse clusterStateResponse) {
            NodesInfoRequest nodesInfoRequest = new NodesInfoRequest();
            nodesInfoRequest.clear().jvm(true).os(true).process(true).http(true);
            client.admin().cluster().nodesInfo(nodesInfoRequest, new RestActionListener<NodesInfoResponse>(channel) {
                @Override
                public void processResponse(final NodesInfoResponse nodesInfoResponse) {
                    NodesStatsRequest nodesStatsRequest = new NodesStatsRequest();
                    nodesStatsRequest.clear().jvm(true).os(true).fs(true).indices(true).process(true).script(true);
                    client.admin().cluster().nodesStats(nodesStatsRequest, new RestResponseListener<NodesStatsResponse>(channel) {
                        @Override
                        public RestResponse buildResponse(NodesStatsResponse nodesStatsResponse) throws Exception {
                            return RestTable.buildResponse(buildTable(fullId, request, clusterStateResponse, nodesInfoResponse,
                                nodesStatsResponse), channel);
                        }
                    });
                }
            });
        }
    });
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:30,代码来源:RestNodesAction.java

示例4: doCatRequest

import org.elasticsearch.action.admin.cluster.node.stats.NodesStatsRequest; //导入依赖的package包/类
@Override
protected RestChannelConsumer doCatRequest(final RestRequest request, final NodeClient client) {
    final NodesStatsRequest nodesStatsRequest = new NodesStatsRequest("data:true");
    nodesStatsRequest.clear();
    nodesStatsRequest.indices(true);
    String[] fields = request.paramAsStringArray("fields", null);
    nodesStatsRequest.indices().fieldDataFields(fields == null ? new String[] {"*"} : fields);

    return channel -> client.admin().cluster().nodesStats(nodesStatsRequest, new RestResponseListener<NodesStatsResponse>(channel) {
        @Override
        public RestResponse buildResponse(NodesStatsResponse nodeStatses) throws Exception {
            return RestTable.buildResponse(buildTable(request, nodeStatses), channel);
        }
    });
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:16,代码来源:RestFielddataAction.java

示例5: doCatRequest

import org.elasticsearch.action.admin.cluster.node.stats.NodesStatsRequest; //导入依赖的package包/类
@Override
public RestChannelConsumer doCatRequest(final RestRequest request, final NodeClient client) {
    final ClusterStateRequest clusterStateRequest = new ClusterStateRequest();
    clusterStateRequest.clear().nodes(true);
    clusterStateRequest.local(request.paramAsBoolean("local", clusterStateRequest.local()));
    clusterStateRequest.masterNodeTimeout(request.paramAsTime("master_timeout", clusterStateRequest.masterNodeTimeout()));

    return channel -> client.admin().cluster().state(clusterStateRequest, new RestActionListener<ClusterStateResponse>(channel) {
        @Override
        public void processResponse(final ClusterStateResponse clusterStateResponse) {
            NodesInfoRequest nodesInfoRequest = new NodesInfoRequest();
            nodesInfoRequest.clear().process(true).threadPool(true);
            client.admin().cluster().nodesInfo(nodesInfoRequest, new RestActionListener<NodesInfoResponse>(channel) {
                @Override
                public void processResponse(final NodesInfoResponse nodesInfoResponse) {
                    NodesStatsRequest nodesStatsRequest = new NodesStatsRequest();
                    nodesStatsRequest.clear().threadPool(true);
                    client.admin().cluster().nodesStats(nodesStatsRequest, new RestResponseListener<NodesStatsResponse>(channel) {
                        @Override
                        public RestResponse buildResponse(NodesStatsResponse nodesStatsResponse) throws Exception {
                            return RestTable.buildResponse(buildTable(request, clusterStateResponse, nodesInfoResponse, nodesStatsResponse), channel);
                        }
                    });
                }
            });
        }
    });
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:29,代码来源:RestThreadPoolAction.java

示例6: updateNodeStats

import org.elasticsearch.action.admin.cluster.node.stats.NodesStatsRequest; //导入依赖的package包/类
/**
 * Retrieve the latest nodes stats, calling the listener when complete
 * @return a latch that can be used to wait for the nodes stats to complete if desired
 */
protected CountDownLatch updateNodeStats(final ActionListener<NodesStatsResponse> listener) {
    final CountDownLatch latch = new CountDownLatch(1);
    final NodesStatsRequest nodesStatsRequest = new NodesStatsRequest("data:true");
    nodesStatsRequest.clear();
    nodesStatsRequest.fs(true);
    nodesStatsRequest.timeout(fetchTimeout);
    client.admin().cluster().nodesStats(nodesStatsRequest, new LatchedActionListener<>(listener, latch));
    return latch;
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:14,代码来源:InternalClusterInfoService.java

示例7: doRequest

import org.elasticsearch.action.admin.cluster.node.stats.NodesStatsRequest; //导入依赖的package包/类
@Override
public void doRequest(final RestRequest request, final RestChannel channel, final Client client) {
    final ClusterStateRequest clusterStateRequest = new ClusterStateRequest();
    clusterStateRequest.clear().nodes(true);
    clusterStateRequest.local(request.paramAsBoolean("local", clusterStateRequest.local()));
    clusterStateRequest.masterNodeTimeout(request.paramAsTime("master_timeout", clusterStateRequest.masterNodeTimeout()));

    client.admin().cluster().state(clusterStateRequest, new RestActionListener<ClusterStateResponse>(channel) {
        @Override
        public void processResponse(final ClusterStateResponse clusterStateResponse) {
            NodesInfoRequest nodesInfoRequest = new NodesInfoRequest();
            nodesInfoRequest.clear().jvm(false).os(false).process(true);
            client.admin().cluster().nodesInfo(nodesInfoRequest, new RestActionListener<NodesInfoResponse>(channel) {
                @Override
                public void processResponse(final NodesInfoResponse nodesInfoResponse) {
                    NodesStatsRequest nodesStatsRequest = new NodesStatsRequest();
                    nodesStatsRequest.clear().jvm(false).os(false).fs(false).indices(false).process(false);
                    client.admin().cluster().nodesStats(nodesStatsRequest, new RestResponseListener<NodesStatsResponse>(channel) {
                        @Override
                        public RestResponse buildResponse(NodesStatsResponse nodesStatsResponse) throws Exception {
                            return RestTable.buildResponse(buildTable(request, clusterStateResponse, nodesInfoResponse, nodesStatsResponse), channel);
                        }
                    });
                }
            });
        }
    });
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:29,代码来源:RestNodeAttrsAction.java

示例8: doRequest

import org.elasticsearch.action.admin.cluster.node.stats.NodesStatsRequest; //导入依赖的package包/类
@Override
public void doRequest(final RestRequest request, final RestChannel channel, final Client client) {
    final ClusterStateRequest clusterStateRequest = new ClusterStateRequest();
    clusterStateRequest.clear().nodes(true);
    clusterStateRequest.local(request.paramAsBoolean("local", clusterStateRequest.local()));
    clusterStateRequest.masterNodeTimeout(request.paramAsTime("master_timeout", clusterStateRequest.masterNodeTimeout()));

    client.admin().cluster().state(clusterStateRequest, new RestActionListener<ClusterStateResponse>(channel) {
        @Override
        public void processResponse(final ClusterStateResponse clusterStateResponse) {
            NodesInfoRequest nodesInfoRequest = new NodesInfoRequest();
            nodesInfoRequest.clear().jvm(true).os(true).process(true);
            client.admin().cluster().nodesInfo(nodesInfoRequest, new RestActionListener<NodesInfoResponse>(channel) {
                @Override
                public void processResponse(final NodesInfoResponse nodesInfoResponse) {
                    NodesStatsRequest nodesStatsRequest = new NodesStatsRequest();
                    nodesStatsRequest.clear().jvm(true).os(true).fs(true).indices(true).process(true).script(true);
                    client.admin().cluster().nodesStats(nodesStatsRequest, new RestResponseListener<NodesStatsResponse>(channel) {
                        @Override
                        public RestResponse buildResponse(NodesStatsResponse nodesStatsResponse) throws Exception {
                            return RestTable.buildResponse(buildTable(request, clusterStateResponse, nodesInfoResponse, nodesStatsResponse), channel);
                        }
                    });
                }
            });
        }
    });
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:29,代码来源:RestNodesAction.java

示例9: doRequest

import org.elasticsearch.action.admin.cluster.node.stats.NodesStatsRequest; //导入依赖的package包/类
@Override
public void doRequest(final RestRequest request, final RestChannel channel, final Client client) {
    final ClusterStateRequest clusterStateRequest = new ClusterStateRequest();
    clusterStateRequest.clear().nodes(true);
    clusterStateRequest.local(request.paramAsBoolean("local", clusterStateRequest.local()));
    clusterStateRequest.masterNodeTimeout(request.paramAsTime("master_timeout", clusterStateRequest.masterNodeTimeout()));

    client.admin().cluster().state(clusterStateRequest, new RestActionListener<ClusterStateResponse>(channel) {
        @Override
        public void processResponse(final ClusterStateResponse clusterStateResponse) {
            NodesInfoRequest nodesInfoRequest = new NodesInfoRequest();
            nodesInfoRequest.clear().process(true).threadPool(true);
            client.admin().cluster().nodesInfo(nodesInfoRequest, new RestActionListener<NodesInfoResponse>(channel) {
                @Override
                public void processResponse(final NodesInfoResponse nodesInfoResponse) {
                    NodesStatsRequest nodesStatsRequest = new NodesStatsRequest();
                    nodesStatsRequest.clear().threadPool(true);
                    client.admin().cluster().nodesStats(nodesStatsRequest, new RestResponseListener<NodesStatsResponse>(channel) {
                        @Override
                        public RestResponse buildResponse(NodesStatsResponse nodesStatsResponse) throws Exception {
                            return RestTable.buildResponse(buildTable(request, clusterStateResponse, nodesInfoResponse, nodesStatsResponse), channel);
                        }
                    });
                }
            });
        }
    });
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:29,代码来源:RestThreadPoolAction.java

示例10: updateNodeStats

import org.elasticsearch.action.admin.cluster.node.stats.NodesStatsRequest; //导入依赖的package包/类
/**
 * Retrieve the latest nodes stats, calling the listener when complete
 * @return a latch that can be used to wait for the nodes stats to complete if desired
 */
protected CountDownLatch updateNodeStats(final ActionListener<NodesStatsResponse> listener) {
    final CountDownLatch latch = new CountDownLatch(1);
    final NodesStatsRequest nodesStatsRequest = new NodesStatsRequest("data:true");
    nodesStatsRequest.clear();
    nodesStatsRequest.fs(true);
    nodesStatsRequest.timeout(fetchTimeout);

    transportNodesStatsAction.execute(nodesStatsRequest, new LatchedActionListener<>(listener, latch));
    return latch;
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:15,代码来源:InternalClusterInfoService.java

示例11: getNodesStats

import org.elasticsearch.action.admin.cluster.node.stats.NodesStatsRequest; //导入依赖的package包/类
protected NodesStatsResponse getNodesStats() {
    final NodesInfoResponse nodesInfoResponse = client.admin().cluster().nodesInfo(new NodesInfoRequest()).actionGet();
    final String[] nodes = new String[nodesInfoResponse.getNodes().length];

    int i = 0;

    for (NodeInfo nodeInfo : nodesInfoResponse.getNodes()) {
        nodes[i++] = nodeInfo.getNode().getName();
    }

    return client.admin().cluster().nodesStats(new NodesStatsRequest(nodes)).actionGet();
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:13,代码来源:ElasticSearchService.java

示例12: nodesStats

import org.elasticsearch.action.admin.cluster.node.stats.NodesStatsRequest; //导入依赖的package包/类
@Override
public ActionFuture<NodesStatsResponse> nodesStats(final NodesStatsRequest request) {
    return execute(NodesStatsAction.INSTANCE, request);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:5,代码来源:AbstractClient.java

示例13: testHttpServerDisabled

import org.elasticsearch.action.admin.cluster.node.stats.NodesStatsRequest; //导入依赖的package包/类
public void testHttpServerDisabled() {
    // test for a bug where if HTTP stats were requested but HTTP was disabled, NodeService would hit a NullPointerException
    NodesStatsResponse response = client().admin().cluster().nodesStats(new NodesStatsRequest().http(true)).actionGet();
    assertThat(response.getNodes(), hasSize(1));
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:6,代码来源:NodeServiceTests.java

示例14: handleRequest

import org.elasticsearch.action.admin.cluster.node.stats.NodesStatsRequest; //导入依赖的package包/类
@Override
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
    String[] nodesIds = Strings.splitStringByCommaToArray(request.param("nodeId"));
    Set<String> metrics = Strings.splitStringByCommaToSet(request.param("metric", "_all"));

    NodesStatsRequest nodesStatsRequest = new NodesStatsRequest(nodesIds);
    nodesStatsRequest.timeout(request.param("timeout"));

    if (metrics.size() == 1 && metrics.contains("_all")) {
        nodesStatsRequest.all();
        nodesStatsRequest.indices(CommonStatsFlags.ALL);
    } else {
        nodesStatsRequest.clear();
        nodesStatsRequest.os(metrics.contains("os"));
        nodesStatsRequest.jvm(metrics.contains("jvm"));
        nodesStatsRequest.threadPool(metrics.contains("thread_pool"));
        nodesStatsRequest.fs(metrics.contains("fs"));
        nodesStatsRequest.transport(metrics.contains("transport"));
        nodesStatsRequest.http(metrics.contains("http"));
        nodesStatsRequest.indices(metrics.contains("indices"));
        nodesStatsRequest.process(metrics.contains("process"));
        nodesStatsRequest.breaker(metrics.contains("breaker"));
        nodesStatsRequest.script(metrics.contains("script"));

        // check for index specific metrics
        if (metrics.contains("indices")) {
            Set<String> indexMetrics = Strings.splitStringByCommaToSet(request.param("indexMetric", "_all"));
            if (indexMetrics.size() == 1 && indexMetrics.contains("_all")) {
                nodesStatsRequest.indices(CommonStatsFlags.ALL);
            } else {
                CommonStatsFlags flags = new CommonStatsFlags();
                for (Flag flag : CommonStatsFlags.Flag.values()) {
                    flags.set(flag, indexMetrics.contains(flag.getRestName()));
                }
                nodesStatsRequest.indices(flags);
            }
        }
    }

    if (nodesStatsRequest.indices().isSet(Flag.FieldData) && (request.hasParam("fields") || request.hasParam("fielddata_fields"))) {
        nodesStatsRequest.indices().fieldDataFields(request.paramAsStringArray("fielddata_fields", request.paramAsStringArray("fields", null)));
    }
    if (nodesStatsRequest.indices().isSet(Flag.Completion) && (request.hasParam("fields") || request.hasParam("completion_fields"))) {
        nodesStatsRequest.indices().completionDataFields(request.paramAsStringArray("completion_fields", request.paramAsStringArray("fields", null)));
    }
    if (nodesStatsRequest.indices().isSet(Flag.Search) && (request.hasParam("groups"))) {
        nodesStatsRequest.indices().groups(request.paramAsStringArray("groups", null));
    }
    if (nodesStatsRequest.indices().isSet(Flag.Indexing) && (request.hasParam("types"))) {
        nodesStatsRequest.indices().types(request.paramAsStringArray("types", null));
    }

    client.admin().cluster().nodesStats(nodesStatsRequest, new RestToXContentListener<NodesStatsResponse>(channel));
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:55,代码来源:RestNodesStatsAction.java

示例15: getNodeStats

import org.elasticsearch.action.admin.cluster.node.stats.NodesStatsRequest; //导入依赖的package包/类
@Override
public NodesStatsResponse getNodeStats() throws ExecutionException, InterruptedException {
    NodesStatsRequest nodesStatsRequest = new NodesStatsRequest();
    nodesStatsRequest.clear().jvm(true).os(true).fs(true).indices(true).process(true).breaker(true);
    return connection.getClient().admin().cluster().nodesStats(nodesStatsRequest).actionGet();
}
 
开发者ID:Flipkart,项目名称:foxtrot,代码行数:7,代码来源:ElasticsearchQueryStore.java


注:本文中的org.elasticsearch.action.admin.cluster.node.stats.NodesStatsRequest类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。