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/10/29 00:46:26 UTC

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

pg-yang commented on code in PR #369:
URL: https://github.com/apache/skywalking-java/pull/369#discussion_r1008595883


##########
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:
   > are you going to use this addr as virtual service
   
   Yes, MQ_BROKER should be complete list 



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