You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by GitBox <gi...@apache.org> on 2022/07/06 04:22:02 UTC

[GitHub] [dolphinscheduler] ruanwenjun commented on a diff in pull request #10749: [Feature][Metrics] Add resource download related metrics for workers

ruanwenjun commented on code in PR #10749:
URL: https://github.com/apache/dolphinscheduler/pull/10749#discussion_r914400318


##########
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/FileUtils.java:
##########
@@ -244,4 +244,15 @@ public static boolean directoryTraversal(String filename){
         }
     }
 
+    /**
+     * Get file size in KB
+     *
+     * @param filename String type of filename
+     * @return file size in KB
+     */
+    public static double getFileSizeInKB(String filename){
+        File file = new File(filename);
+        return ((double) file.length()) / 1024;

Review Comment:
   You can directly use org.apache.commons.io.FileUtils.ONE_KB



-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

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