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 2022/11/01 02:39:27 UTC

[GitHub] [skywalking-java] wu-sheng commented on a diff in pull request #369: Add MQ_TOPIC and MQ_BROKER tags for RocketMQ consumer's span

wu-sheng commented on code in PR #369:
URL: https://github.com/apache/skywalking-java/pull/369#discussion_r1010022571


##########
apm-sniffer/apm-sdk-plugin/rocketMQ-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/rocketMQ/v4/AbstractMessageConsumeInterceptor.java:
##########
@@ -48,7 +50,12 @@ public final void beforeMethod(EnhancedInstance objInst, Method method, Object[]
         ContextCarrier contextCarrier = getContextCarrierFromMessage(msgs.get(0));
         AbstractSpan span = ContextManager.createEntrySpan(CONSUMER_OPERATION_NAME_PREFIX + msgs.get(0)
                                                                                                 .getTopic() + "/Consumer", contextCarrier);
-
+        Tags.MQ_TOPIC.set(span, msgs.get(0).getTopic());
+        if (msgs.get(0).getStoreHost() != null) {
+            String brokerAddress = msgs.get(0).getStoreHost().toString();
+            brokerAddress = StringUtils.removeStart(brokerAddress, "/");
+            Tags.MQ_BROKER.set(span, brokerAddress);

Review Comment:
   Peer should be set, otherwise your topology breaks.
   Check my posted issue and discussion.



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