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 2020/03/17 04:24:36 UTC

[GitHub] [skywalking] dmsolr opened a new pull request #4529: [hotfix] Fix AlarmQuery query condition issue

dmsolr opened a new pull request #4529: [hotfix] Fix AlarmQuery query condition issue
URL: https://github.com/apache/skywalking/pull/4529
 
 
   Please answer these questions before submitting pull request
   
   - Why submit this pull request?
   - [x] Bug fix
   - [ ] New feature provided
   - [ ] Improve performance
   
   - Related issues
   
   ___
   ### Bug fix
   - Bug description.
   
   `regex(..)` need to append prefix and suffix, '/'. 
   
   - How to fix?
   Uses `contains(...)` to instead of it.
   

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


With regards,
Apache Git Services

[GitHub] [skywalking] kezhenxu94 commented on a change in pull request #4529: [hotfix] Fix AlarmQuery query condition issue

Posted by GitBox <gi...@apache.org>.
kezhenxu94 commented on a change in pull request #4529: [hotfix] Fix AlarmQuery query condition issue
URL: https://github.com/apache/skywalking/pull/4529#discussion_r393441777
 
 

 ##########
 File path: oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/query/AlarmQuery.java
 ##########
 @@ -64,7 +64,7 @@ public Alarms getAlarm(Integer scopeId, String keyword, int limit, int from, lon
                        .and(lte(InfluxClient.TIME, InfluxClient.timeInterval(endTB)));
         }
         if (!Strings.isNullOrEmpty(keyword)) {
-            recallQuery.and(regex(AlarmRecord.ALARM_MESSAGE, keyword));
+            recallQuery.and(contains(AlarmRecord.ALARM_MESSAGE, keyword.replaceAll("/", "\\/")));
 
 Review comment:
   ```suggestion
               recallQuery.and(contains(AlarmRecord.ALARM_MESSAGE, keyword.replaceAll("/", "\\\\/")));
   ```

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


With regards,
Apache Git Services

[GitHub] [skywalking] codecov-io commented on issue #4529: [hotfix] Fix AlarmQuery query condition issue

Posted by GitBox <gi...@apache.org>.
codecov-io commented on issue #4529: [hotfix] Fix AlarmQuery query condition issue
URL: https://github.com/apache/skywalking/pull/4529#issuecomment-599887059
 
 
   # [Codecov](https://codecov.io/gh/apache/skywalking/pull/4529?src=pr&el=h1) Report
   > Merging [#4529](https://codecov.io/gh/apache/skywalking/pull/4529?src=pr&el=desc) into [master](https://codecov.io/gh/apache/skywalking/commit/c8187ccd416c1e9da84f06e2cc7c939c54d84380&el=desc) will **decrease** coverage by `0.00%`.
   > The diff coverage is `0.00%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/skywalking/pull/4529/graphs/tree.svg?width=650&height=150&src=pr&token=qrILxY5yA8)](https://codecov.io/gh/apache/skywalking/pull/4529?src=pr&el=tree)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master    #4529      +/-   ##
   ==========================================
   - Coverage   25.53%   25.53%   -0.01%     
   ==========================================
     Files        1244     1244              
     Lines       28951    28951              
     Branches     3968     3968              
   ==========================================
   - Hits         7393     7392       -1     
     Misses      20874    20874              
   - Partials      684      685       +1     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/skywalking/pull/4529?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [...rver/storage/plugin/influxdb/query/AlarmQuery.java](https://codecov.io/gh/apache/skywalking/pull/4529/diff?src=pr&el=tree#diff-b2FwLXNlcnZlci9zZXJ2ZXItc3RvcmFnZS1wbHVnaW4vc3RvcmFnZS1pbmZsdXhkYi1wbHVnaW4vc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NreXdhbGtpbmcvb2FwL3NlcnZlci9zdG9yYWdlL3BsdWdpbi9pbmZsdXhkYi9xdWVyeS9BbGFybVF1ZXJ5LmphdmE=) | `0.00% <0.00%> (ø)` | |
   | [.../agent/core/profile/ProfileTaskChannelService.java](https://codecov.io/gh/apache/skywalking/pull/4529/diff?src=pr&el=tree#diff-YXBtLXNuaWZmZXIvYXBtLWFnZW50LWNvcmUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NreXdhbGtpbmcvYXBtL2FnZW50L2NvcmUvcHJvZmlsZS9Qcm9maWxlVGFza0NoYW5uZWxTZXJ2aWNlLmphdmE=) | `24.73% <0.00%> (-1.08%)` | :arrow_down: |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/skywalking/pull/4529?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/skywalking/pull/4529?src=pr&el=footer). Last update [c8187cc...dc5f5b7](https://codecov.io/gh/apache/skywalking/pull/4529?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   

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


With regards,
Apache Git Services

[GitHub] [skywalking] kezhenxu94 commented on a change in pull request #4529: [hotfix] Fix AlarmQuery query condition issue

Posted by GitBox <gi...@apache.org>.
kezhenxu94 commented on a change in pull request #4529: [hotfix] Fix AlarmQuery query condition issue
URL: https://github.com/apache/skywalking/pull/4529#discussion_r393444540
 
 

 ##########
 File path: oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/query/AlarmQuery.java
 ##########
 @@ -64,7 +64,7 @@ public Alarms getAlarm(Integer scopeId, String keyword, int limit, int from, lon
                        .and(lte(InfluxClient.TIME, InfluxClient.timeInterval(endTB)));
         }
         if (!Strings.isNullOrEmpty(keyword)) {
-            recallQuery.and(regex(AlarmRecord.ALARM_MESSAGE, keyword));
+            recallQuery.and(contains(AlarmRecord.ALARM_MESSAGE, keyword.replaceAll("/", "\\/")));
 
 Review comment:
   > > Why four ? How many do we need?
   > 
   > `"\\"` => `\`, `\` in regexp pattern is for escaping, so `\\\\` in string literal => `"\\(escape in string literal)\\(escape in string literal)"` => `\\` (escape `\` in regexp)
   
   @wu-sheng @dmsolr if you're not sure, please refer to the JavaDoc of `java.util.regex.Matcher#replaceAll` or simply run the following test:
   
   ```java
       public static void main(String[] args) {
           System.out.println("/abc/".replaceAll("/", "\\/"));
           // still produce /abc/ , not \/abc\/
           System.out.println("/abc/".replaceAll("/", "\\\\/"));
           // produce \/abc\/ , which is what we want,
       }
   ```

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


With regards,
Apache Git Services

[GitHub] [skywalking] kezhenxu94 commented on a change in pull request #4529: [hotfix] Fix AlarmQuery query condition issue

Posted by GitBox <gi...@apache.org>.
kezhenxu94 commented on a change in pull request #4529: [hotfix] Fix AlarmQuery query condition issue
URL: https://github.com/apache/skywalking/pull/4529#discussion_r393443819
 
 

 ##########
 File path: oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/query/AlarmQuery.java
 ##########
 @@ -64,7 +64,7 @@ public Alarms getAlarm(Integer scopeId, String keyword, int limit, int from, lon
                        .and(lte(InfluxClient.TIME, InfluxClient.timeInterval(endTB)));
         }
         if (!Strings.isNullOrEmpty(keyword)) {
-            recallQuery.and(regex(AlarmRecord.ALARM_MESSAGE, keyword));
+            recallQuery.and(contains(AlarmRecord.ALARM_MESSAGE, keyword.replaceAll("/", "\\/")));
 
 Review comment:
   > @kezhenxu94 we may need an e2e query for alarm in the future.
   
   please create an issue to track in case we all forget

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


With regards,
Apache Git Services

[GitHub] [skywalking] wu-sheng merged pull request #4529: [hotfix] Fix AlarmQuery query condition issue

Posted by GitBox <gi...@apache.org>.
wu-sheng merged pull request #4529: [hotfix] Fix AlarmQuery query condition issue
URL: https://github.com/apache/skywalking/pull/4529
 
 
   

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


With regards,
Apache Git Services

[GitHub] [skywalking] wu-sheng commented on a change in pull request #4529: [hotfix] Fix AlarmQuery query condition issue

Posted by GitBox <gi...@apache.org>.
wu-sheng commented on a change in pull request #4529: [hotfix] Fix AlarmQuery query condition issue
URL: https://github.com/apache/skywalking/pull/4529#discussion_r393442613
 
 

 ##########
 File path: oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/query/AlarmQuery.java
 ##########
 @@ -64,7 +64,7 @@ public Alarms getAlarm(Integer scopeId, String keyword, int limit, int from, lon
                        .and(lte(InfluxClient.TIME, InfluxClient.timeInterval(endTB)));
         }
         if (!Strings.isNullOrEmpty(keyword)) {
-            recallQuery.and(regex(AlarmRecord.ALARM_MESSAGE, keyword));
+            recallQuery.and(contains(AlarmRecord.ALARM_MESSAGE, keyword.replaceAll("/", "\\/")));
 
 Review comment:
   Why four \? How many do we need?
   
   @kezhenxu94 we may need an e2e query for alarm in the future.

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


With regards,
Apache Git Services

[GitHub] [skywalking] wu-sheng commented on a change in pull request #4529: [hotfix] Fix AlarmQuery query condition issue

Posted by GitBox <gi...@apache.org>.
wu-sheng commented on a change in pull request #4529: [hotfix] Fix AlarmQuery query condition issue
URL: https://github.com/apache/skywalking/pull/4529#discussion_r393447068
 
 

 ##########
 File path: oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/query/AlarmQuery.java
 ##########
 @@ -64,7 +64,7 @@ public Alarms getAlarm(Integer scopeId, String keyword, int limit, int from, lon
                        .and(lte(InfluxClient.TIME, InfluxClient.timeInterval(endTB)));
         }
         if (!Strings.isNullOrEmpty(keyword)) {
-            recallQuery.and(regex(AlarmRecord.ALARM_MESSAGE, keyword));
+            recallQuery.and(contains(AlarmRecord.ALARM_MESSAGE, keyword.replaceAll("/", "\\/")));
 
 Review comment:
   Got it

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


With regards,
Apache Git Services

[GitHub] [skywalking] kezhenxu94 commented on a change in pull request #4529: [hotfix] Fix AlarmQuery query condition issue

Posted by GitBox <gi...@apache.org>.
kezhenxu94 commented on a change in pull request #4529: [hotfix] Fix AlarmQuery query condition issue
URL: https://github.com/apache/skywalking/pull/4529#discussion_r393443740
 
 

 ##########
 File path: oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/query/AlarmQuery.java
 ##########
 @@ -64,7 +64,7 @@ public Alarms getAlarm(Integer scopeId, String keyword, int limit, int from, lon
                        .and(lte(InfluxClient.TIME, InfluxClient.timeInterval(endTB)));
         }
         if (!Strings.isNullOrEmpty(keyword)) {
-            recallQuery.and(regex(AlarmRecord.ALARM_MESSAGE, keyword));
+            recallQuery.and(contains(AlarmRecord.ALARM_MESSAGE, keyword.replaceAll("/", "\\/")));
 
 Review comment:
   > Why four ? How many do we need?
   > 
   
   `"\\"` => `\`, `\` in regexp pattern is for escaping, so `\\\\` in string literal => `"\\(escape in string literal)\\(escape in string literal)"` => `\\` (escape `\` in regexp)

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


With regards,
Apache Git Services