smiklosovic commented on code in PR #3628:
URL: https://github.com/apache/cassandra/pull/3628#discussion_r1815682924


##########
src/java/org/apache/cassandra/tools/nodetool/stats/CompactionHistoryHolder.java:
##########
@@ -82,12 +85,17 @@ private HashMap<String, Object> getAllAsMap()
             Instant instant = Instant.ofEpochMilli(this.compactedAt);
             LocalDateTime ldt = LocalDateTime.ofInstant(instant, 
ZoneId.systemDefault());
             compaction.put("compacted_at", ldt.toString());
-            compaction.put("bytes_in", this.bytesIn);
-            compaction.put("bytes_out", this.bytesOut);
+            compaction.put("bytes_in", format(this.bytesIn, humanReadable));
+            compaction.put("bytes_out", format(this.bytesOut, humanReadable));
             compaction.put("rows_merged", this.rowMerged);
             compaction.put("compaction_properties", this.compactionProperties);
             return compaction;
         }
+
+        private String format(long bytes, boolean humanReadable)

Review Comment:
   there are there methods like this if you grep the body of this method. Can 
not we create e.g. a static method in StatsHolder? Feel free to find better 
place to put it. For `example org.apache.cassandra.io.utils.FileUtils` is not 
bad either.



##########
src/java/org/apache/cassandra/tools/nodetool/stats/CompactionHistoryHolder.java:
##########
@@ -122,7 +130,7 @@ public Map<String, Object> convert2Map()
         Collections.sort(chrList);
         for (CompactionHistoryHolder.CompactionHistoryRow chr : chrList)
         {
-            compactions.add(chr.getAllAsMap());
+            compactions.add(chr.getAllAsMap(this.humanReadable));

Review Comment:
   nit: `this` is not necessary



-- 
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]

Reply via email to