Tejaskriya commented on code in PR #6083:
URL: https://github.com/apache/ozone/pull/6083#discussion_r1483915856
##########
hadoop-hdds/tools/src/main/java/org/apache/hadoop/hdds/scm/cli/datanode/DecommissionStatusSubCommand.java:
##########
@@ -94,4 +133,95 @@ private void printDetails(DatanodeDetails datanode) {
" (" + datanode.getNetworkLocation() + "/" + datanode.getIpAddress()
+ "/" + datanode.getHostName() + ")");
}
+ private void printCounts(DatanodeDetails datanode, Map<String, Object>
counts, int numDecomNodes) {
+ try {
+ for (int i = 1; i <= numDecomNodes; i++) {
+ if (datanode.getHostName().equals(counts.get("tag.datanode." + i))) {
+ int pipelines = ((Double)counts.get("PipelinesWaitingToCloseDN." +
i)).intValue();
+ int underReplicated = ((Double)counts.get("UnderReplicatedDN." +
i)).intValue();
+ int unclosed = ((Double)counts.get("UnclosedContainersDN." +
i)).intValue();
+ long startTime = ((Double)counts.get("StartTimeDN." +
i)).longValue();
+ System.out.print("Decommission started at : ");
+ Date date = new Date(startTime);
+ DateFormat formatter = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss z");
+ System.out.println(formatter.format(date));
+ System.out.println("No. of Pipelines: " + pipelines);
+ System.out.println("No. of UnderReplicated containers: " +
underReplicated);
+ System.out.println("No. of Unclosed Containers: " + unclosed);
+ return;
+ }
+ }
+ System.err.println("Error getting pipeline and container counts for " +
datanode.getHostName());
+ } catch (NullPointerException ex) {
+ System.err.println("Error getting pipeline and container counts for " +
datanode.getHostName());
+ }
+ }
+
+ private Map<String, Object> getCounts() {
+ Map<String, Object> finalResult = new HashMap<>();
+ try {
+ StringBuffer url = new StringBuffer();
+ final OzoneConfiguration ozoneConf = parent
+ .getParent()
+ .getParent()
+ .getOzoneConf();
+ final String protocol;
+ final URLConnectionFactory connectionFactory =
URLConnectionFactory.newDefaultURLConnectionFactory(ozoneConf);
+ final HttpConfig.Policy webPolicy = getHttpPolicy(ozoneConf);
+ String host;
+ InputStream inputStream;
+ int errorCode;
+
+ if (webPolicy.isHttpsEnabled()) {
Review Comment:
To solve these issues, as you had suggested during our discussions, a better
way would be to have something similar to JMXJsonServerlet from hadoop-common
library in ozone which can return any filtered metrics through grpc calls. This
way we avoid dealing with http calls issues like handling security and finding
the scm leader to get the right metrics. We would still getting the metrics
from MBeansServer and not adding any significant overhead in scm.
I have raised this PR with this new approach:
[#6185](https://github.com/apache/ozone/pull/6185)
Please do review it. Thank you!
--
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]