gerlowskija commented on code in PR #4154:
URL: https://github.com/apache/solr/pull/4154#discussion_r2867912153
##########
solr/core/src/java/org/apache/solr/cli/StatusTool.java:
##########
@@ -318,23 +318,24 @@ public static Map<String, Object> reportStatus(SolrClient
solrClient) throws Exc
}
/**
- * Calls the CLUSTERSTATUS endpoint in Solr to get basic status information
about the SolrCloud
- * cluster.
+ * Calls V2 API endpoints to get basic status information about the
SolrCloud cluster.
+ *
+ * <p>Uses GET /cluster/nodes for live node count and GET /collections for
collection count.
*/
- @SuppressWarnings("unchecked")
private static Map<String, String> getCloudStatus(SolrClient solrClient,
String zkHost)
throws Exception {
Map<String, String> cloudStatus = new LinkedHashMap<>();
cloudStatus.put("ZooKeeper", (zkHost != null) ? zkHost : "?");
- // TODO add booleans to request just what we want; not everything
- NamedList<Object> json = solrClient.request(new
CollectionAdminRequest.ClusterStatus());
-
- List<String> liveNodes = (List<String>) json._get(List.of("cluster",
"live_nodes"), null);
- cloudStatus.put("liveNodes", String.valueOf(liveNodes.size()));
+ var nodesResponse = new ClusterApi.ListClusterNodes().process(solrClient);
+ var liveNodes = nodesResponse != null ? nodesResponse.nodes : null;
+ cloudStatus.put("liveNodes", String.valueOf(liveNodes != null ?
liveNodes.size() : 0));
- // TODO get this as a metric from the metrics API instead, or something
else.
- var collections = (Map<String, Object>) json._get(List.of("cluster",
"collections"), null);
+ var collectionsResponse = new
CollectionsApi.ListCollections().process(solrClient);
Review Comment:
Ah, right - looking at the subsequent line it looks like we only look at the
size of the collections object. My mistake.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]