You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by GitBox <gi...@apache.org> on 2021/10/28 07:49:35 UTC

[GitHub] [skywalking] zhyyu opened a new pull request #8035: fix config yaml data type conversion bug

zhyyu opened a new pull request #8035:
URL: https://github.com/apache/skywalking/pull/8035


   <!--
       ⚠️ Please make sure to read this template first, pull requests that don't accord with this template
       maybe closed without notice.
       Texts surrounded by `<` and `>` are meant to be replaced by you, e.g. <framework name>, <issue number>.
       Put an `x` in the `[ ]` to mark the item as CHECKED. `[x]`
   -->
   
   <!-- ==== 🐛 Remove this line WHEN AND ONLY WHEN you're fixing a bug, follow the checklist 👇 ====
   ### Fix <bug description or the bug issue number or bug issue link>
   - [ ] Add a unit test to verify that the fix works.
   - [ ] Explain briefly why the bug exists and how to fix it.
        ==== 🐛 Remove this line WHEN AND ONLY WHEN you're fixing a bug, follow the checklist 👆 ==== -->
   
   <!-- ==== 📈 Remove this line WHEN AND ONLY WHEN you're improving the performance, follow the checklist 👇 ====
   ### Improve the performance of <class or module or ...>
   - [ ] Add a benchmark for the improvement, refer to [the existing ones](https://github.com/apache/skywalking/blob/master/apm-commons/apm-datacarrier/src/test/java/org/apache/skywalking/apm/commons/datacarrier/LinkedArrayBenchmark.java)
   - [ ] The benchmark result.
   ```text
   <Paste the benchmark results here>
   ```
   - [ ] Links/URLs to the theory proof or discussion articles/blogs. <links/URLs here>
        ==== 📈 Remove this line WHEN AND ONLY WHEN you're improving the performance, follow the checklist 👆 ==== -->
   
   <!-- ==== 🆕 Remove this line WHEN AND ONLY WHEN you're adding a new feature, follow the checklist 👇 ====
   ### <Feature description>
   - [ ] If this is non-trivial feature, paste the links/URLs to the design doc.
   - [ ] Update the documentation to include this new feature.
   - [ ] Tests(including UT, IT, E2E) are added to verify the new feature.
   - [ ] If it's UI related, attach the screenshots below.
        ==== 🆕 Remove this line WHEN AND ONLY WHEN you're adding a new feature, follow the checklist 👆 ==== -->
   
   - [x] If this pull request closes/resolves/fixes an existing issue, replace the issue number. Closes [#8092](https://github.com/apache/skywalking/issues/8029).
   - [ ] Update the [`CHANGES` log](https://github.com/apache/skywalking/blob/master/CHANGES.md).
   


-- 
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: notifications-unsubscribe@skywalking.apache.org

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



[GitHub] [skywalking] wu-sheng commented on a change in pull request #8035: fix config yaml data type conversion bug

Posted by GitBox <gi...@apache.org>.
wu-sheng commented on a change in pull request #8035:
URL: https://github.com/apache/skywalking/pull/8035#discussion_r739083621



##########
File path: oap-server/server-starter/src/main/java/org/apache/skywalking/oap/server/starter/config/ApplicationConfigLoader.java
##########
@@ -125,6 +126,20 @@ private void replacePropertyAndLog(final Object propertyName, final Object prope
         }
     }
 
+    private Object convertValueString(String valueString) {
+        try {
+            Object replaceValue = yaml.load(valueString);
+            if (replaceValue instanceof String || replaceValue instanceof Integer || replaceValue instanceof Long || replaceValue instanceof Boolean || replaceValue instanceof ArrayList) {
+                return replaceValue;
+            } else {
+                return valueString;
+            }

Review comment:
       OK, make sense.




-- 
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: notifications-unsubscribe@skywalking.apache.org

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



[GitHub] [skywalking] zhyyu commented on a change in pull request #8035: fix config yaml data type conversion bug

Posted by GitBox <gi...@apache.org>.
zhyyu commented on a change in pull request #8035:
URL: https://github.com/apache/skywalking/pull/8035#discussion_r739075239



##########
File path: oap-server/server-starter/src/main/java/org/apache/skywalking/oap/server/starter/config/ApplicationConfigLoader.java
##########
@@ -125,6 +126,20 @@ private void replacePropertyAndLog(final Object propertyName, final Object prope
         }
     }
 
+    private Object convertValueString(String valueString) {
+        try {
+            Object replaceValue = yaml.load(valueString);
+            if (replaceValue instanceof String || replaceValue instanceof Integer || replaceValue instanceof Long || replaceValue instanceof Boolean || replaceValue instanceof ArrayList) {
+                return replaceValue;
+            } else {
+                return valueString;
+            }

Review comment:
       I just worry about there are some config name or expression will be like `animal: pets` or some other hit yaml grammar like `e: !!str 123`, yaml will parse it like object or truncated string, not the origin string. So I limit the yaml parse Class(one of `String Integer Long Boolean ArrayList`), if yaml parsed Object is not one of it, the result will use origin String.




-- 
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: notifications-unsubscribe@skywalking.apache.org

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



[GitHub] [skywalking] wu-sheng commented on a change in pull request #8035: fix config yaml data type conversion bug

Posted by GitBox <gi...@apache.org>.
wu-sheng commented on a change in pull request #8035:
URL: https://github.com/apache/skywalking/pull/8035#discussion_r739061080



##########
File path: oap-server/server-starter/src/main/java/org/apache/skywalking/oap/server/starter/config/ApplicationConfigLoader.java
##########
@@ -125,6 +126,20 @@ private void replacePropertyAndLog(final Object propertyName, final Object prope
         }
     }
 
+    private Object convertValueString(String valueString) {
+        try {
+            Object replaceValue = yaml.load(valueString);
+            if (replaceValue instanceof String || replaceValue instanceof Integer || replaceValue instanceof Long || replaceValue instanceof Boolean || replaceValue instanceof ArrayList) {
+                return replaceValue;
+            } else {
+                return valueString;
+            }

Review comment:
       But `animal: pets` isn't supported for the core or extension, isn't it? If so, we should throw exception here rather than returning an unsupported value.




-- 
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: notifications-unsubscribe@skywalking.apache.org

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



[GitHub] [skywalking] zhyyu commented on pull request #8035: fix config yaml data type conversion bug

Posted by GitBox <gi...@apache.org>.
zhyyu commented on pull request #8035:
URL: https://github.com/apache/skywalking/pull/8035#issuecomment-954503671


   > ```
   > Error:  Tests run: 5, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 1.447 s <<< FAILURE! - in org.apache.skywalking.oap.server.starter.config.ApplicationConfigLoaderTestCase
   > Error:  testLoadIntegerTypeConfig(org.apache.skywalking.oap.server.starter.config.ApplicationConfigLoaderTestCase)  Time elapsed: 0.995 s  <<< FAILURE!
   > java.lang.AssertionError: expected:<9941> but was:<9411>
   > 	at org.apache.skywalking.oap.server.starter.config.ApplicationConfigLoaderTestCase.testLoadIntegerTypeConfig(ApplicationConfigLoaderTestCase.java:76)
   > 
   > Error:  Failures: 
   > Error:    ApplicationConfigLoaderTestCase.testLoadIntegerTypeConfig:76 expected:<9941> but was:<9411>
   > Error:  Tests run: 6, Failures: 1, Errors: 0, Skipped: 0
   > ```
   > 
   > Notice, test still fails.
   
   Sry, type error. Now test all success.


-- 
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: notifications-unsubscribe@skywalking.apache.org

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



[GitHub] [skywalking] wu-sheng commented on pull request #8035: fix config yaml data type conversion bug

Posted by GitBox <gi...@apache.org>.
wu-sheng commented on pull request #8035:
URL: https://github.com/apache/skywalking/pull/8035#issuecomment-954641054


   Just a confirm, is this case failing in the master branch codes? Have you tested that?


-- 
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: notifications-unsubscribe@skywalking.apache.org

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



[GitHub] [skywalking] zhyyu commented on a change in pull request #8035: fix config yaml data type conversion bug

Posted by GitBox <gi...@apache.org>.
zhyyu commented on a change in pull request #8035:
URL: https://github.com/apache/skywalking/pull/8035#discussion_r738962393



##########
File path: oap-server/server-starter/src/main/java/org/apache/skywalking/oap/server/starter/config/ApplicationConfigLoader.java
##########
@@ -125,6 +126,20 @@ private void replacePropertyAndLog(final Object propertyName, final Object prope
         }
     }
 
+    private Object convertValueString(String valueString) {
+        try {
+            Object replaceValue = yaml.load(valueString);
+            if (replaceValue instanceof String || replaceValue instanceof Integer || replaceValue instanceof Long || replaceValue instanceof Boolean || replaceValue instanceof ArrayList) {
+                return replaceValue;
+            } else {
+                return valueString;
+            }

Review comment:
       UTs added, changes.md 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: notifications-unsubscribe@skywalking.apache.org

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



[GitHub] [skywalking] zhyyu commented on a change in pull request #8035: fix config yaml data type conversion bug

Posted by GitBox <gi...@apache.org>.
zhyyu commented on a change in pull request #8035:
URL: https://github.com/apache/skywalking/pull/8035#discussion_r739049587



##########
File path: oap-server/server-starter/src/main/java/org/apache/skywalking/oap/server/starter/config/ApplicationConfigLoader.java
##########
@@ -125,6 +126,20 @@ private void replacePropertyAndLog(final Object propertyName, final Object prope
         }
     }
 
+    private Object convertValueString(String valueString) {
+        try {
+            Object replaceValue = yaml.load(valueString);
+            if (replaceValue instanceof String || replaceValue instanceof Integer || replaceValue instanceof Long || replaceValue instanceof Boolean || replaceValue instanceof ArrayList) {
+                return replaceValue;
+            } else {
+                return valueString;
+            }

Review comment:
       the `else` case occur when there is a config string like `animal: pets`, yaml will load it as an object, and return replaceValue isn't  class `String`. I review all the application.yaml config, I found that all the config feild type is one of `String  Integer Long  Boolean  ArrayList `, so I add the `if else` check.




-- 
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: notifications-unsubscribe@skywalking.apache.org

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



[GitHub] [skywalking] zhyyu commented on pull request #8035: fix config yaml data type conversion bug

Posted by GitBox <gi...@apache.org>.
zhyyu commented on pull request #8035:
URL: https://github.com/apache/skywalking/pull/8035#issuecomment-954477276


   > Could you fix the CI?
   
   I have deleted UT empty line and passed checkstyle plugin, maven package success locally.


-- 
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: notifications-unsubscribe@skywalking.apache.org

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



[GitHub] [skywalking] wu-sheng merged pull request #8035: fix config yaml data type conversion bug

Posted by GitBox <gi...@apache.org>.
wu-sheng merged pull request #8035:
URL: https://github.com/apache/skywalking/pull/8035


   


-- 
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: notifications-unsubscribe@skywalking.apache.org

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



[GitHub] [skywalking] zhyyu commented on a change in pull request #8035: fix config yaml data type conversion bug

Posted by GitBox <gi...@apache.org>.
zhyyu commented on a change in pull request #8035:
URL: https://github.com/apache/skywalking/pull/8035#discussion_r739110973



##########
File path: oap-server/server-starter/src/main/java/org/apache/skywalking/oap/server/starter/config/ApplicationConfigLoader.java
##########
@@ -125,6 +126,20 @@ private void replacePropertyAndLog(final Object propertyName, final Object prope
         }
     }
 
+    private Object convertValueString(String valueString) {
+        try {
+            Object replaceValue = yaml.load(valueString);
+            if (replaceValue instanceof String || replaceValue instanceof Integer || replaceValue instanceof Long || replaceValue instanceof Boolean || replaceValue instanceof ArrayList) {
+                return replaceValue;
+            } else {
+                return valueString;
+            }

Review comment:
       Have added special password `!AI!3B` UT for related the error case issue.




-- 
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: notifications-unsubscribe@skywalking.apache.org

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



[GitHub] [skywalking] wu-sheng commented on a change in pull request #8035: fix config yaml data type conversion bug

Posted by GitBox <gi...@apache.org>.
wu-sheng commented on a change in pull request #8035:
URL: https://github.com/apache/skywalking/pull/8035#discussion_r738116540



##########
File path: oap-server/server-starter/src/main/java/org/apache/skywalking/oap/server/starter/config/ApplicationConfigLoader.java
##########
@@ -125,6 +126,20 @@ private void replacePropertyAndLog(final Object propertyName, final Object prope
         }
     }
 
+    private Object convertValueString(String valueString) {
+        try {
+            Object replaceValue = yaml.load(valueString);
+            if (replaceValue instanceof String || replaceValue instanceof Integer || replaceValue instanceof Long || replaceValue instanceof Boolean || replaceValue instanceof ArrayList) {
+                return replaceValue;
+            } else {
+                return valueString;
+            }

Review comment:
       Could you add UTs to verify and test what is the case here? And please update the changes.md in the root.




-- 
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: notifications-unsubscribe@skywalking.apache.org

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



[GitHub] [skywalking] wu-sheng commented on a change in pull request #8035: fix config yaml data type conversion bug

Posted by GitBox <gi...@apache.org>.
wu-sheng commented on a change in pull request #8035:
URL: https://github.com/apache/skywalking/pull/8035#discussion_r738981369



##########
File path: oap-server/server-starter/src/main/java/org/apache/skywalking/oap/server/starter/config/ApplicationConfigLoader.java
##########
@@ -125,6 +126,20 @@ private void replacePropertyAndLog(final Object propertyName, final Object prope
         }
     }
 
+    private Object convertValueString(String valueString) {
+        try {
+            Object replaceValue = yaml.load(valueString);
+            if (replaceValue instanceof String || replaceValue instanceof Integer || replaceValue instanceof Long || replaceValue instanceof Boolean || replaceValue instanceof ArrayList) {
+                return replaceValue;
+            } else {
+                return valueString;
+            }

Review comment:
       I can't see what is the case following into this `else`, could you explain a little?
   
   Also, I can't see the case relating to the error case you reported. Could you add it there too?




-- 
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: notifications-unsubscribe@skywalking.apache.org

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



[GitHub] [skywalking] wu-sheng commented on pull request #8035: fix config yaml data type conversion bug

Posted by GitBox <gi...@apache.org>.
wu-sheng commented on pull request #8035:
URL: https://github.com/apache/skywalking/pull/8035#issuecomment-954492506


   ```
   Error:  Tests run: 5, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 1.447 s <<< FAILURE! - in org.apache.skywalking.oap.server.starter.config.ApplicationConfigLoaderTestCase
   Error:  testLoadIntegerTypeConfig(org.apache.skywalking.oap.server.starter.config.ApplicationConfigLoaderTestCase)  Time elapsed: 0.995 s  <<< FAILURE!
   java.lang.AssertionError: expected:<9941> but was:<9411>
   	at org.apache.skywalking.oap.server.starter.config.ApplicationConfigLoaderTestCase.testLoadIntegerTypeConfig(ApplicationConfigLoaderTestCase.java:76)
   
   Error:  Failures: 
   Error:    ApplicationConfigLoaderTestCase.testLoadIntegerTypeConfig:76 expected:<9941> but was:<9411>
   Error:  Tests run: 6, Failures: 1, Errors: 0, Skipped: 0
   ```
   
   Notice, test still fails.


-- 
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: notifications-unsubscribe@skywalking.apache.org

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



[GitHub] [skywalking] wu-sheng commented on pull request #8035: fix config yaml data type conversion bug

Posted by GitBox <gi...@apache.org>.
wu-sheng commented on pull request #8035:
URL: https://github.com/apache/skywalking/pull/8035#issuecomment-954466423


   Could you fix the CI?


-- 
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: notifications-unsubscribe@skywalking.apache.org

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