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 2021/09/10 17:46:19 UTC

[GitHub] [rocketmq-dashboard] zhangjidi2016 opened a new pull request #21: [ISSUE #19]Message track query enhancement

zhangjidi2016 opened a new pull request #21:
URL: https://github.com/apache/rocketmq-dashboard/pull/21


   ## What is the purpose of the change
   
   #19
   
   ## Brief changelog
   
   XX
   
   ## 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.

To unsubscribe, e-mail: dev-unsubscribe@rocketmq.apache.org

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



[GitHub] [rocketmq-dashboard] zhangjidi2016 commented on a change in pull request #21: [ISSUE #19]Message track query enhancement

Posted by GitBox <gi...@apache.org>.
zhangjidi2016 commented on a change in pull request #21:
URL: https://github.com/apache/rocketmq-dashboard/pull/21#discussion_r708868780



##########
File path: src/main/java/org/apache/rocketmq/dashboard/controller/MessageTraceController.java
##########
@@ -64,7 +64,7 @@ public Object viewTraceMessages(@RequestParam String msgId) {
 
     @RequestMapping(value = "/viewMessageTraceGraph.query", method = RequestMethod.GET)
     @ResponseBody
-    public MessageTraceGraph viewMessageTraceGraph(@RequestParam String msgId) {
-        return messageTraceService.queryMessageTraceGraph(msgId);
+    public MessageTraceGraph viewMessageTraceGraph(@RequestParam String msgId, @RequestParam String traceTopic) {

Review comment:
       TraceTopic can be empty and system topic (RMQ_SYS_TRACE_TOPIC) is used by default.




-- 
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: dev-unsubscribe@rocketmq.apache.org

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



[GitHub] [rocketmq-dashboard] StyleTang commented on a change in pull request #21: [ISSUE #19]Message track query enhancement

Posted by GitBox <gi...@apache.org>.
StyleTang commented on a change in pull request #21:
URL: https://github.com/apache/rocketmq-dashboard/pull/21#discussion_r706566464



##########
File path: src/main/java/org/apache/rocketmq/dashboard/controller/MessageTraceController.java
##########
@@ -64,7 +64,7 @@ public Object viewTraceMessages(@RequestParam String msgId) {
 
     @RequestMapping(value = "/viewMessageTraceGraph.query", method = RequestMethod.GET)
     @ResponseBody
-    public MessageTraceGraph viewMessageTraceGraph(@RequestParam String msgId) {
-        return messageTraceService.queryMessageTraceGraph(msgId);
+    public MessageTraceGraph viewMessageTraceGraph(@RequestParam String msgId, @RequestParam String traceTopic) {

Review comment:
       Is traceTopic must have? maybe we can use the default value if use don't choose the topic.
   ```
   @RequestParam String traceTopic
   ```

##########
File path: src/main/java/org/apache/rocketmq/dashboard/service/impl/TopicServiceImpl.java
##########
@@ -61,16 +61,28 @@
     private RMQConfigure configure;
 
     @Override
-    public TopicList fetchAllTopicList(boolean skipSysProcess) {
+    public TopicList fetchAllTopicList(boolean skipSysProcess, boolean skipRetryAndDlq) {
         try {
             TopicList allTopics = mqAdminExt.fetchAllTopicList();
             if (skipSysProcess) {
                 return allTopics;
             }
 
-            TopicList sysTopics = getSystemTopicList();
             Set<String> topics = new HashSet<>();
+            if (skipRetryAndDlq) {

Review comment:
       1. What will happen if both skipSysProcess and skipRetryAndDlq are true.
   2. maybe we can handle skipSysProcess and skipRetryAndDlq together, for example use Java lambda stream.
   ```java
   allTopics.getTopicList().stream().map((item)->{
                   ...
               }).filter(new Predicate<String>() {
                   @Override
                   public boolean apply(@Nullable String input) {
                       ...
                   }
               }).collect(Collectors.toSet());
   ```




-- 
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: dev-unsubscribe@rocketmq.apache.org

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



[GitHub] [rocketmq-dashboard] StyleTang merged pull request #21: [ISSUE #19]Message track query enhancement

Posted by GitBox <gi...@apache.org>.
StyleTang merged pull request #21:
URL: https://github.com/apache/rocketmq-dashboard/pull/21


   


-- 
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: dev-unsubscribe@rocketmq.apache.org

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



[GitHub] [rocketmq-dashboard] zhangjidi2016 commented on a change in pull request #21: [ISSUE #19]Message track query enhancement

Posted by GitBox <gi...@apache.org>.
zhangjidi2016 commented on a change in pull request #21:
URL: https://github.com/apache/rocketmq-dashboard/pull/21#discussion_r708874722



##########
File path: src/main/java/org/apache/rocketmq/dashboard/service/impl/TopicServiceImpl.java
##########
@@ -61,16 +61,28 @@
     private RMQConfigure configure;
 
     @Override
-    public TopicList fetchAllTopicList(boolean skipSysProcess) {
+    public TopicList fetchAllTopicList(boolean skipSysProcess, boolean skipRetryAndDlq) {
         try {
             TopicList allTopics = mqAdminExt.fetchAllTopicList();
             if (skipSysProcess) {
                 return allTopics;
             }
 
-            TopicList sysTopics = getSystemTopicList();
             Set<String> topics = new HashSet<>();
+            if (skipRetryAndDlq) {

Review comment:
       Yes,  need to take into account the fact that both skipSysProcess and skipRetryAndDlq are true,I will optimize this method using stream.




-- 
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: dev-unsubscribe@rocketmq.apache.org

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



[GitHub] [rocketmq-dashboard] StyleTang commented on a change in pull request #21: [ISSUE #19]Message track query enhancement

Posted by GitBox <gi...@apache.org>.
StyleTang commented on a change in pull request #21:
URL: https://github.com/apache/rocketmq-dashboard/pull/21#discussion_r710923255



##########
File path: src/main/resources/static/src/messageTrace.js
##########
@@ -39,16 +43,25 @@ module.controller('messageTraceController', ['$scope', '$routeParams', 'ngDialog
         method: "GET",
         url: "topic/list.query",
         params: {
-            skipSysProcess: "true"
+            skipSysProcess: true
         }
     }).success(function (resp) {
         if (resp.status == 0) {
             $scope.allTopicList = resp.data.topicList.sort();
-            console.log($scope.allTopicList);
+            console.log($scope.allTopicList)
+            for (const topic of $scope.allTopicList) {
+                if (topic.startsWith(RETRY_GROUP_TOPIC_PREFIX)
+                    || topic.startsWith(DLQ_GROUP_TOPIC_PREFIX)) {

Review comment:
       👍
   It’s great to delete useless system topics
   

##########
File path: src/main/java/org/apache/rocketmq/dashboard/service/impl/TopicServiceImpl.java
##########
@@ -61,23 +63,23 @@
     private RMQConfigure configure;
 
     @Override
-    public TopicList fetchAllTopicList(boolean skipSysProcess) {
+    public TopicList fetchAllTopicList(boolean skipSysProcess, boolean skipRetryAndDlq) {
         try {
             TopicList allTopics = mqAdminExt.fetchAllTopicList();
-            if (skipSysProcess) {
-                return allTopics;
-            }
-
             TopicList sysTopics = getSystemTopicList();
-            Set<String> topics = new HashSet<>();
-
-            for (String topic : allTopics.getTopicList()) {
-                if (sysTopics.getTopicList().contains(topic)) {
-                    topics.add(String.format("%s%s", "%SYS%", topic));
-                } else {
-                    topics.add(topic);
-                }
-            }
+            Set<String> topics =
+                allTopics.getTopicList().stream().map(topic -> {
+                    if (!skipSysProcess && sysTopics.getTopicList().contains(topic)) {
+                        topic = String.format("%s%s", "%SYS%", topic);
+                    }
+                    return topic;
+                }).filter(topic -> {
+                    if (skipRetryAndDlq) {
+                        return !(topic.startsWith(MixAll.RETRY_GROUP_TOPIC_PREFIX)
+                            || topic.startsWith(MixAll.DLQ_GROUP_TOPIC_PREFIX));
+                    }
+                    return true;
+                }).collect(Collectors.toSet());
             allTopics.getTopicList().clear();
             allTopics.getTopicList().addAll(topics);

Review comment:
       Trivial. (and it is not introduced by this PR, I'm OK to merge it)
   can just use 
   ```java
   allTopics.setTopicList(topics);
   ```




-- 
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: dev-unsubscribe@rocketmq.apache.org

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



[GitHub] [rocketmq-dashboard] StyleTang commented on pull request #21: [ISSUE #19]Message track query enhancement

Posted by GitBox <gi...@apache.org>.
StyleTang commented on pull request #21:
URL: https://github.com/apache/rocketmq-dashboard/pull/21#issuecomment-921015009


   In my point of view, I don't suggest putting the topic selection on the popover. It’s more appropriate to put it on the page.
   If we put it on the message trace page, for most users who use the default message track topic, they can just ignore it, but on the popover, the unnecessary click is required.
   
   
   ![image](https://user-images.githubusercontent.com/5286751/133641576-40a8d483-f76b-4ad8-be64-65edca19528e.png)
   
   I suggest something like below 
   ![image](https://user-images.githubusercontent.com/5286751/133642546-17c4bcf2-6888-4c79-9a48-61231f853bbd.png)
   


-- 
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: dev-unsubscribe@rocketmq.apache.org

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