You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@kafka.apache.org by GitBox <gi...@apache.org> on 2020/04/20 11:17:26 UTC

[GitHub] [kafka] tombentley commented on a change in pull request #8222: KAFKA-9650: include human readable units in ms and bytes configs

tombentley commented on a change in pull request #8222:
URL: https://github.com/apache/kafka/pull/8222#discussion_r411295815



##########
File path: clients/src/main/java/org/apache/kafka/common/config/ConfigDef.java
##########
@@ -1179,6 +1186,50 @@ protected String getConfigValue(ConfigKey key, String headerName) {
         }
     }
 
+    private static String niceMemoryUnits(ConfigKey key) {
+        final long defaultValueBytes = ((Number) key.defaultValue).longValue();
+        long defaultValue = defaultValueBytes;
+        int i = 0;
+        while (i < 5) {
+            if (defaultValue % 1024 != 0) {
+                break;
+            }
+            defaultValue /= 1024;
+            i++;
+        }
+        switch (i) {
+            case 1:
+                return " (=" + defaultValue + "KiB)";

Review comment:
       You're right, but in this case we're dealing with kibibytes, not kilobyes, and [it seems](https://en.wikipedia.org/wiki/Kibibyte) in this case KiB is the standard abbreviation.




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org