Expose nodes operation timeout in REST API
Currently it's not possible to specify a timeout for nodes operations (such as node info, node stats, cluster stats and hot threads) via REST-based APIs.
This commit is contained in:
parent
42718936d9
commit
a358f34276
|
@ -58,6 +58,7 @@ public class RestNodesHotThreadsAction extends BaseRestHandler {
|
|||
nodesHotThreadsRequest.type(request.param("type", nodesHotThreadsRequest.type()));
|
||||
nodesHotThreadsRequest.interval(TimeValue.parseTimeValue(request.param("interval"), nodesHotThreadsRequest.interval(), "interval"));
|
||||
nodesHotThreadsRequest.snapshots(request.paramAsInt("snapshots", nodesHotThreadsRequest.snapshots()));
|
||||
nodesHotThreadsRequest.timeout(request.param("timeout"));
|
||||
client.admin().cluster().nodesHotThreads(nodesHotThreadsRequest, new RestResponseListener<NodesHotThreadsResponse>(channel) {
|
||||
@Override
|
||||
public RestResponse buildResponse(NodesHotThreadsResponse response) throws Exception {
|
||||
|
|
|
@ -87,6 +87,7 @@ public class RestNodesInfoAction extends BaseRestHandler {
|
|||
}
|
||||
|
||||
final NodesInfoRequest nodesInfoRequest = new NodesInfoRequest(nodeIds);
|
||||
nodesInfoRequest.timeout(request.param("timeout"));
|
||||
// shortcut, dont do checks if only all is specified
|
||||
if (metrics.size() == 1 && metrics.contains("_all")) {
|
||||
nodesInfoRequest.all();
|
||||
|
|
|
@ -60,6 +60,7 @@ public class RestNodesStatsAction extends BaseRestHandler {
|
|||
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();
|
||||
|
|
|
@ -43,6 +43,7 @@ public class RestClusterStatsAction extends BaseRestHandler {
|
|||
@Override
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
|
||||
ClusterStatsRequest clusterStatsRequest = new ClusterStatsRequest().nodesIds(request.paramAsStringArray("nodeId", null));
|
||||
clusterStatsRequest.timeout(request.param("timeout"));
|
||||
client.admin().cluster().clusterStats(clusterStatsRequest, new RestToXContentListener<ClusterStatsResponse>(channel));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,6 +20,10 @@
|
|||
"type": "boolean",
|
||||
"description": "Whether to return time and byte values in human-readable format.",
|
||||
"default": false
|
||||
},
|
||||
"timeout": {
|
||||
"type" : "time",
|
||||
"description" : "Explicit operation timeout"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
"type" : "number",
|
||||
"description" : "Specify the number of threads to provide information for (default: 3)"
|
||||
},
|
||||
"ignore_idle_threads": {
|
||||
"ignore_idle_threads": {
|
||||
"type" : "boolean",
|
||||
"description" : "Don't show threads that are in known-idle places, such as waiting on a socket select or pulling from an empty task queue (default: true)"
|
||||
},
|
||||
|
@ -32,6 +32,10 @@
|
|||
"type" : "enum",
|
||||
"options" : ["cpu", "wait", "block"],
|
||||
"description" : "The type to sample (default: cpu)"
|
||||
},
|
||||
"timeout": {
|
||||
"type" : "time",
|
||||
"description" : "Explicit operation timeout"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -25,6 +25,10 @@
|
|||
"type": "boolean",
|
||||
"description": "Whether to return time and byte values in human-readable format.",
|
||||
"default": false
|
||||
},
|
||||
"timeout": {
|
||||
"type" : "time",
|
||||
"description" : "Explicit operation timeout"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -59,6 +59,10 @@
|
|||
"types" : {
|
||||
"type" : "list",
|
||||
"description" : "A comma-separated list of document types for the `indexing` index metric"
|
||||
},
|
||||
"timeout": {
|
||||
"type" : "time",
|
||||
"description" : "Explicit operation timeout"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue