priyeshkaratha commented on code in PR #9681:
URL: https://github.com/apache/ozone/pull/9681#discussion_r2802503403
##########
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/api/StorageDistributionEndpoint.java:
##########
@@ -114,6 +128,85 @@ public Response getStorageDistribution() {
}
}
+ @GET
+ @Path("/download")
+ public Response downloadDataNodeDistribution() {
+ DataNodeMetricsServiceResponse metricsResponse =
+ dataNodeMetricsService.getCollectedMetrics(null);
+
+ if (metricsResponse.getStatus() !=
DataNodeMetricsService.MetricCollectionStatus.FINISHED) {
+ return Response.status(Response.Status.ACCEPTED)
+ .entity(metricsResponse)
+ .type(MediaType.APPLICATION_JSON)
+ .build();
+ }
+
+ List<DatanodePendingDeletionMetrics> pendingDeletionMetrics =
+ metricsResponse.getPendingDeletionPerDataNode();
+
+ if (pendingDeletionMetrics == null) {
+ return Response.status(Response.Status.INTERNAL_SERVER_ERROR)
+ .entity("Metrics data is missing despite FINISHED status.")
+ .type(MediaType.TEXT_PLAIN)
+ .build();
+ }
+
+ Map<String, DatanodeStorageReport> reportByUuid =
+ collectDatanodeReports().stream()
+ .collect(Collectors.toMap(
+ DatanodeStorageReport::getDatanodeUuid,
+ Function.identity()));
+
+ StreamingOutput stream = output -> {
+ CSVFormat format = CSVFormat.DEFAULT.builder()
+ .setHeader(
+ "HostName",
+ "Datanode UUID",
+ "Capacity",
+ "Used Space",
+ "Remaining Space",
+ "Committed Space",
+ "Reserved Space",
+ "Minimum Free Space",
+ "Pending Block Size")
Review Comment:
Yes, that will be better. Updated
--
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]