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


##########
apm-sniffer/apm-sdk-plugin/rocketMQ-client-java-5.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/rocketMQ/client/java/v5/MessageListenerInterceptor.java:
##########
@@ -37,30 +38,38 @@
 public class MessageListenerInterceptor implements 
InstanceMethodsAroundInterceptor {
 
     public static final String CONSUMER_OPERATION_NAME_PREFIX = "RocketMQ/";
+    public static final Gson GSON = new Gson();
 
     @Override
-    public void beforeMethod(EnhancedInstance objInst, Method method, Object[] 
allArguments, Class<?>[] argumentsTypes, MethodInterceptResult result) throws 
Throwable {
+    public void beforeMethod(EnhancedInstance objInst,
+                             Method method,
+                             Object[] allArguments,
+                             Class<?>[] argumentsTypes,
+                             MethodInterceptResult result) throws Throwable {
         MessageView messageView = (MessageView) allArguments[0];
 
         ContextCarrier contextCarrier = 
getContextCarrierFromMessage(messageView);
 
         AbstractSpan span = 
ContextManager.createEntrySpan(CONSUMER_OPERATION_NAME_PREFIX + 
messageView.getTopic()
-                + "/Consumer", contextCarrier);
+                                                               + "/Consumer", 
contextCarrier);
         Tags.MQ_TOPIC.set(span, messageView.getTopic());
-
+        span.tag(Tags.ofKey("mq.message.id"), 
messageView.getMessageId().toString());

Review Comment:
   `Tags#ofKey` is very expensive. The tag should be a static field, rather 
than created repeatedly.



-- 
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-unsubscr...@skywalking.apache.org

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

Reply via email to