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/09/14 10:10:38 UTC

[GitHub] [rocketmq-externals] maixiaohai opened a new pull request #633: [ISSUE #632] Fix console UI show trace message detail return wrong

maixiaohai opened a new pull request #633:
URL: https://github.com/apache/rocketmq-externals/pull/633


   ## What is the purpose of the change
   
   issue #632 
   ## Brief changelog
   
   Fix query by messge id show trace message detail failed
   
   ## 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-externals] vongosling commented on a change in pull request #633: [ISSUE #632] Fix console UI show trace message detail return wrong

Posted by GitBox <gi...@apache.org>.
vongosling commented on a change in pull request #633:
URL: https://github.com/apache/rocketmq-externals/pull/633#discussion_r487836484



##########
File path: rocketmq-console/src/main/java/org/apache/rocketmq/console/service/impl/MessageTraceServiceImpl.java
##########
@@ -42,11 +42,9 @@
     @Override public List<MessageTraceView> queryMessageTraceByTopicAndKey(String topic, String key) {
         try {
             List<MessageTraceView> messageTraceViews = new ArrayList<MessageTraceView>();
-            List<MessageExt> messageTraceList = mqAdminExt.queryMessage(topic, key, QUERY_MESSAGE_MAX_NUM, 0, System.currentTimeMillis()).getMessageList();
-            for (MessageExt messageExt : messageTraceList) {
-                List<MessageTraceView> messageTraceView = MessageTraceView.decodeFromTraceTransData(key, new String(messageExt.getBody(), Charsets.UTF_8));
-                messageTraceViews.addAll(messageTraceView);
-            }
+            MessageExt messageExt = mqAdminExt.viewMessage(topic, key);

Review comment:
       Do you omit the range of the query?




----------------------------------------------------------------
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-externals] maixiaohai closed pull request #633: [ISSUE #632] Fix console UI show trace message detail return wrong

Posted by GitBox <gi...@apache.org>.
maixiaohai closed pull request #633:
URL: https://github.com/apache/rocketmq-externals/pull/633


   


----------------------------------------------------------------
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-externals] maixiaohai commented on a change in pull request #633: [ISSUE #632] Fix console UI show trace message detail return wrong

Posted by GitBox <gi...@apache.org>.
maixiaohai commented on a change in pull request #633:
URL: https://github.com/apache/rocketmq-externals/pull/633#discussion_r487866541



##########
File path: rocketmq-console/src/main/java/org/apache/rocketmq/console/service/impl/MessageTraceServiceImpl.java
##########
@@ -42,11 +42,9 @@
     @Override public List<MessageTraceView> queryMessageTraceByTopicAndKey(String topic, String key) {
         try {
             List<MessageTraceView> messageTraceViews = new ArrayList<MessageTraceView>();
-            List<MessageExt> messageTraceList = mqAdminExt.queryMessage(topic, key, QUERY_MESSAGE_MAX_NUM, 0, System.currentTimeMillis()).getMessageList();
-            for (MessageExt messageExt : messageTraceList) {
-                List<MessageTraceView> messageTraceView = MessageTraceView.decodeFromTraceTransData(key, new String(messageExt.getBody(), Charsets.UTF_8));
-                messageTraceViews.addAll(messageTraceView);
-            }
+            MessageExt messageExt = mqAdminExt.viewMessage(topic, key);

Review comment:
       QueryMessage method seems have a different parameter with ViewMessage method, and  QueryMessage need a input parameter **key**, while here we query by msgId, so always the api return "query message by key finished, but no message".
   Actually, I'm not quite sure about the difference between **key** and **msgId**, so I read the source code of **QueryMessageProcessor** class , it has two methods viewMessageById and queryMessage, queryMessage seems a kind of batch search.




----------------------------------------------------------------
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-externals] maixiaohai closed pull request #633: [ISSUE #632] Fix console UI show trace message detail return wrong

Posted by GitBox <gi...@apache.org>.
maixiaohai closed pull request #633:
URL: https://github.com/apache/rocketmq-externals/pull/633


   


----------------------------------------------------------------
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-externals] vongosling commented on a change in pull request #633: [ISSUE #632] Fix console UI show trace message detail return wrong

Posted by GitBox <gi...@apache.org>.
vongosling commented on a change in pull request #633:
URL: https://github.com/apache/rocketmq-externals/pull/633#discussion_r494261376



##########
File path: rocketmq-console/src/main/java/org/apache/rocketmq/console/service/impl/MessageTraceServiceImpl.java
##########
@@ -42,11 +42,9 @@
     @Override public List<MessageTraceView> queryMessageTraceByTopicAndKey(String topic, String key) {
         try {
             List<MessageTraceView> messageTraceViews = new ArrayList<MessageTraceView>();
-            List<MessageExt> messageTraceList = mqAdminExt.queryMessage(topic, key, QUERY_MESSAGE_MAX_NUM, 0, System.currentTimeMillis()).getMessageList();
-            for (MessageExt messageExt : messageTraceList) {
-                List<MessageTraceView> messageTraceView = MessageTraceView.decodeFromTraceTransData(key, new String(messageExt.getBody(), Charsets.UTF_8));
-                messageTraceViews.addAll(messageTraceView);
-            }
+            MessageExt messageExt = mqAdminExt.viewMessage(topic, key);

Review comment:
       In this case, you could use a key to trace messages with the same key.




----------------------------------------------------------------
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-externals] maixiaohai commented on a change in pull request #633: [ISSUE #632] Fix console UI show trace message detail return wrong

Posted by GitBox <gi...@apache.org>.
maixiaohai commented on a change in pull request #633:
URL: https://github.com/apache/rocketmq-externals/pull/633#discussion_r494712350



##########
File path: rocketmq-console/src/main/java/org/apache/rocketmq/console/service/impl/MessageTraceServiceImpl.java
##########
@@ -42,11 +42,9 @@
     @Override public List<MessageTraceView> queryMessageTraceByTopicAndKey(String topic, String key) {
         try {
             List<MessageTraceView> messageTraceViews = new ArrayList<MessageTraceView>();
-            List<MessageExt> messageTraceList = mqAdminExt.queryMessage(topic, key, QUERY_MESSAGE_MAX_NUM, 0, System.currentTimeMillis()).getMessageList();
-            for (MessageExt messageExt : messageTraceList) {
-                List<MessageTraceView> messageTraceView = MessageTraceView.decodeFromTraceTransData(key, new String(messageExt.getBody(), Charsets.UTF_8));
-                messageTraceViews.addAll(messageTraceView);
-            }
+            MessageExt messageExt = mqAdminExt.viewMessage(topic, key);

Review comment:
       I've figured it out. I used the wrong topic **RMQ_SYS_TRACE_TOPIC**. Thanks!




----------------------------------------------------------------
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-externals] maixiaohai commented on a change in pull request #633: [ISSUE #632] Fix console UI show trace message detail return wrong

Posted by GitBox <gi...@apache.org>.
maixiaohai commented on a change in pull request #633:
URL: https://github.com/apache/rocketmq-externals/pull/633#discussion_r494712350



##########
File path: rocketmq-console/src/main/java/org/apache/rocketmq/console/service/impl/MessageTraceServiceImpl.java
##########
@@ -42,11 +42,9 @@
     @Override public List<MessageTraceView> queryMessageTraceByTopicAndKey(String topic, String key) {
         try {
             List<MessageTraceView> messageTraceViews = new ArrayList<MessageTraceView>();
-            List<MessageExt> messageTraceList = mqAdminExt.queryMessage(topic, key, QUERY_MESSAGE_MAX_NUM, 0, System.currentTimeMillis()).getMessageList();
-            for (MessageExt messageExt : messageTraceList) {
-                List<MessageTraceView> messageTraceView = MessageTraceView.decodeFromTraceTransData(key, new String(messageExt.getBody(), Charsets.UTF_8));
-                messageTraceViews.addAll(messageTraceView);
-            }
+            MessageExt messageExt = mqAdminExt.viewMessage(topic, key);

Review comment:
       I've figured it out. I used the wrong topic **RMQ_SYS_TRACE_TOPIC**. Thanks!




----------------------------------------------------------------
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-externals] vongosling commented on a change in pull request #633: [ISSUE #632] Fix console UI show trace message detail return wrong

Posted by GitBox <gi...@apache.org>.
vongosling commented on a change in pull request #633:
URL: https://github.com/apache/rocketmq-externals/pull/633#discussion_r494261376



##########
File path: rocketmq-console/src/main/java/org/apache/rocketmq/console/service/impl/MessageTraceServiceImpl.java
##########
@@ -42,11 +42,9 @@
     @Override public List<MessageTraceView> queryMessageTraceByTopicAndKey(String topic, String key) {
         try {
             List<MessageTraceView> messageTraceViews = new ArrayList<MessageTraceView>();
-            List<MessageExt> messageTraceList = mqAdminExt.queryMessage(topic, key, QUERY_MESSAGE_MAX_NUM, 0, System.currentTimeMillis()).getMessageList();
-            for (MessageExt messageExt : messageTraceList) {
-                List<MessageTraceView> messageTraceView = MessageTraceView.decodeFromTraceTransData(key, new String(messageExt.getBody(), Charsets.UTF_8));
-                messageTraceViews.addAll(messageTraceView);
-            }
+            MessageExt messageExt = mqAdminExt.viewMessage(topic, key);

Review comment:
       In this case, you could use a key to trace messages with the same key.




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