use of org.elasticsearch.action.admin.cluster.tasks.PendingClusterTasksRequest in project elasticsearch by elastic.
the class RestPendingClusterTasksAction method doCatRequest.
@Override
public RestChannelConsumer doCatRequest(final RestRequest request, final NodeClient client) {
PendingClusterTasksRequest pendingClusterTasksRequest = new PendingClusterTasksRequest();
pendingClusterTasksRequest.masterNodeTimeout(request.paramAsTime("master_timeout", pendingClusterTasksRequest.masterNodeTimeout()));
pendingClusterTasksRequest.local(request.paramAsBoolean("local", pendingClusterTasksRequest.local()));
return channel -> client.admin().cluster().pendingClusterTasks(pendingClusterTasksRequest, new RestResponseListener<PendingClusterTasksResponse>(channel) {
@Override
public RestResponse buildResponse(PendingClusterTasksResponse pendingClusterTasks) throws Exception {
Table tab = buildTable(request, pendingClusterTasks);
return RestTable.buildResponse(tab, channel);
}
});
}
use of org.elasticsearch.action.admin.cluster.tasks.PendingClusterTasksRequest in project graylog2-server by Graylog2.
the class ElasticsearchProbe method elasticsearchStats.
public ElasticsearchStats elasticsearchStats() {
final ClusterAdminClient adminClient = client.admin().cluster();
final ClusterStatsResponse clusterStatsResponse = adminClient.clusterStats(new ClusterStatsRequest()).actionGet();
final String clusterName = clusterStatsResponse.getClusterNameAsString();
final ClusterStatsNodes clusterNodesStats = clusterStatsResponse.getNodesStats();
final NodesStats nodesStats = NodesStats.create(clusterNodesStats.getCounts().getTotal(), clusterNodesStats.getCounts().getMasterOnly(), clusterNodesStats.getCounts().getDataOnly(), clusterNodesStats.getCounts().getMasterData(), clusterNodesStats.getCounts().getClient());
final IndicesStats indicesStats = IndicesStats.create(clusterStatsResponse.getIndicesStats().getIndexCount(), clusterStatsResponse.getIndicesStats().getStore().sizeInBytes(), clusterStatsResponse.getIndicesStats().getFieldData().getMemorySizeInBytes());
final PendingClusterTasksResponse pendingClusterTasksResponse = adminClient.pendingClusterTasks(new PendingClusterTasksRequest()).actionGet();
final int pendingTasksSize = pendingClusterTasksResponse.pendingTasks().size();
final List<Long> pendingTasksTimeInQueue = Lists.newArrayListWithCapacity(pendingTasksSize);
for (PendingClusterTask pendingClusterTask : pendingClusterTasksResponse) {
pendingTasksTimeInQueue.add(pendingClusterTask.getTimeInQueueInMillis());
}
final ClusterHealthResponse clusterHealthResponse = adminClient.health(new ClusterHealthRequest(indexSetRegistry.getIndexWildcards())).actionGet();
final ClusterHealth clusterHealth = ClusterHealth.create(clusterHealthResponse.getNumberOfNodes(), clusterHealthResponse.getNumberOfDataNodes(), clusterHealthResponse.getActiveShards(), clusterHealthResponse.getRelocatingShards(), clusterHealthResponse.getActivePrimaryShards(), clusterHealthResponse.getInitializingShards(), clusterHealthResponse.getUnassignedShards(), clusterHealthResponse.isTimedOut(), pendingTasksSize, pendingTasksTimeInQueue);
return ElasticsearchStats.create(clusterName, clusterHealthResponse.getStatus(), clusterHealth, nodesStats, indicesStats);
}
use of org.elasticsearch.action.admin.cluster.tasks.PendingClusterTasksRequest in project elasticsearch by elastic.
the class RestPendingClusterTasksAction method prepareRequest.
@Override
public RestChannelConsumer prepareRequest(final RestRequest request, final NodeClient client) throws IOException {
PendingClusterTasksRequest pendingClusterTasksRequest = new PendingClusterTasksRequest();
pendingClusterTasksRequest.masterNodeTimeout(request.paramAsTime("master_timeout", pendingClusterTasksRequest.masterNodeTimeout()));
pendingClusterTasksRequest.local(request.paramAsBoolean("local", pendingClusterTasksRequest.local()));
return channel -> client.admin().cluster().pendingClusterTasks(pendingClusterTasksRequest, new RestToXContentListener<>(channel));
}
Aggregations