You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@rocketmq.apache.org by GitBox <gi...@apache.org> on 2020/06/23 02:26:51 UTC

[GitHub] [rocketmq] imaffe opened a new pull request #2116: [ISSUE #2067] add logs when collecting disk space usage

imaffe opened a new pull request #2116:
URL: https://github.com/apache/rocketmq/pull/2116


   ## What is the purpose of the change
   
   1. issue #2067 , need more detailed log to find why the path is invalid.
   ## Brief changelog
   
   1. added 3 log statement
   
   ## Verifying this change
   
   XXXX
   
   Follow this checklist to help us incorporate your contribution quickly and easily. Notice, `it would be helpful if you could finish the following 5 checklist(the last one is not necessary)before request the community to review your PR`.
   
   - [x] Make sure there is a [Github issue](https://github.com/apache/rocketmq/issues) filed for the change (usually before you start working on it). Trivial changes like typos do not require a Github issue. Your pull request should address just this issue, without pulling in other changes - one PR resolves one issue. 
   - [x] Format the pull request title like `[ISSUE #123] Fix UnknownException when host config not exist`. Each commit in the pull request should have a meaningful subject line and body.
   - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
   - [x] Write necessary unit-test(over 80% coverage) to verify your logic correction, more mock a little better when cross module dependency exist. If the new feature or significant change is committed, please remember to add integration-test in [test module](https://github.com/apache/rocketmq/tree/master/test).
   - [x] Run `mvn -B clean apache-rat:check findbugs:findbugs checkstyle:checkstyle` to make sure basic checks pass. Run `mvn clean install -DskipITs` to make sure unit-test pass. Run `mvn clean test-compile failsafe:integration-test`  to make sure integration-test pass.
   - [ ] If this contribution is large, please file an [Apache Individual Contributor License Agreement](http://www.apache.org/licenses/#clas).
   


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



[GitHub] [rocketmq] RongtongJin merged pull request #2116: [ISSUE #2067] Add logs when collecting disk space usage

Posted by GitBox <gi...@apache.org>.
RongtongJin merged pull request #2116:
URL: https://github.com/apache/rocketmq/pull/2116


   


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



[GitHub] [rocketmq] coveralls commented on pull request #2116: [ISSUE #2067] add logs when collecting disk space usage

Posted by GitBox <gi...@apache.org>.
coveralls commented on pull request #2116:
URL: https://github.com/apache/rocketmq/pull/2116#issuecomment-647880828


   
   [![Coverage Status](https://coveralls.io/builds/31620393/badge)](https://coveralls.io/builds/31620393)
   
   Coverage increased (+0.02%) to 50.866% when pulling **b32dbc47ffcf613ed046a2be9b683e66fd186e0f on imaffe:affe-0623-#2067-addlogs-disk-usage** into **e923a35393a6dfa83677335e96fdb4b063f10d32 on apache:master**.
   


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



[GitHub] [rocketmq] coveralls edited a comment on pull request #2116: [ISSUE #2067] add logs when collecting disk space usage

Posted by GitBox <gi...@apache.org>.
coveralls edited a comment on pull request #2116:
URL: https://github.com/apache/rocketmq/pull/2116#issuecomment-647880828


   
   [![Coverage Status](https://coveralls.io/builds/31650236/badge)](https://coveralls.io/builds/31650236)
   
   Coverage increased (+0.07%) to 50.92% when pulling **c3e29587eec1424ebf1ba7919b7c063fd93773c1 on imaffe:affe-0623-#2067-addlogs-disk-usage** into **e923a35393a6dfa83677335e96fdb4b063f10d32 on apache:master**.
   


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



[GitHub] [rocketmq] RongtongJin commented on a change in pull request #2116: [ISSUE #2067] add logs when collecting disk space usage

Posted by GitBox <gi...@apache.org>.
RongtongJin commented on a change in pull request #2116:
URL: https://github.com/apache/rocketmq/pull/2116#discussion_r444630349



##########
File path: common/src/main/java/org/apache/rocketmq/common/UtilAll.java
##########
@@ -200,14 +200,20 @@ public static String timeMillisToHumanString3(final long t) {
     }
 
     public static double getDiskPartitionSpaceUsedPercent(final String path) {
-        if (null == path || path.isEmpty())
+        if (null == path || path.isEmpty()) {
+            log.error("Error when measuring disk space usage, path is null or empty, path :" + path);
             return -1;
+        }
+
 
         try {
             File file = new File(path);
 
-            if (!file.exists())
+            if (!file.exists()) {
+                log.error("Error when measuring disk space usage, file doesn't exist on this path: " + path);

Review comment:
       It would be better to use placeholder instead of string concatenation.

##########
File path: common/src/main/java/org/apache/rocketmq/common/UtilAll.java
##########
@@ -218,6 +224,8 @@ public static double getDiskPartitionSpaceUsedPercent(final String path) {
                 return usedSpace / (double) totalSpace;
             }
         } catch (Exception e) {
+            log.error("Error when measuring disk space usage, got exception: ");
+            e.printStackTrace();
             return -1;

Review comment:
       It would be better to write as `log.error("xxxxxxxxxxx", e)`




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