This is an automated email from the ASF dual-hosted git repository.

wusheng pushed a commit to branch 6.0
in repository https://gitbox.apache.org/repos/asf/incubator-skywalking.git

commit 6bea7abe982204b3e12ee308664f8c41e01b3bc3
Author: XiaoFu <with...@yeah.net>
AuthorDate: Sun Aug 5 07:25:55 2018 +0800

    Update ActiveMQProducerInterceptor.java (#1522)
---
 .../apm/plugin/activemq/ActiveMQProducerInterceptor.java       | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git 
a/apm-sniffer/apm-sdk-plugin/activemq-5.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/activemq/ActiveMQProducerInterceptor.java
 
b/apm-sniffer/apm-sdk-plugin/activemq-5.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/activemq/ActiveMQProducerInterceptor.java
index 19acf56..37d1d00 100644
--- 
a/apm-sniffer/apm-sdk-plugin/activemq-5.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/activemq/ActiveMQProducerInterceptor.java
+++ 
b/apm-sniffer/apm-sdk-plugin/activemq-5.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/activemq/ActiveMQProducerInterceptor.java
@@ -39,6 +39,10 @@ import java.lang.reflect.Method;
 public class ActiveMQProducerInterceptor implements 
InstanceMethodsAroundInterceptor {
     public static final String OPERATE_NAME_PREFIX = "ActiveMQ/";
     public static final String PRODUCER_OPERATE_NAME_SUFFIX = "/Producer";
+    public static final byte QUEUE_TYPE = 1;
+    public static final byte TOPIC_TYPE = 2;
+    public static final byte TEMP_TOPIC_TYPE = 6;
+    public static final byte TEMP_QUEUE_TYPE = 5;
     @Override
     public void beforeMethod(EnhancedInstance objInst, Method method, Object[] 
allArguments, Class<?>[] argumentsTypes, MethodInterceptResult result) throws 
Throwable {
 
@@ -47,12 +51,12 @@ public class ActiveMQProducerInterceptor implements 
InstanceMethodsAroundInterce
         Message message = (Message)  allArguments[1];
         String url = (String) objInst.getSkyWalkingDynamicField();
         AbstractSpan activeSpan = null;
-        if (activeMQDestination.getDestinationType() == 1 || 
activeMQDestination.getDestinationType() == 5) {
+        if (activeMQDestination.getDestinationType() == QUEUE_TYPE || 
activeMQDestination.getDestinationType() == TEMP_QUEUE_TYPE) {
             activeSpan = ContextManager.createExitSpan(OPERATE_NAME_PREFIX + 
"Queue/" + activeMQDestination.getPhysicalName() + 
PRODUCER_OPERATE_NAME_SUFFIX, contextCarrier, url);
             Tags.MQ_BROKER.set(activeSpan,url);
             
Tags.MQ_QUEUE.set(activeSpan,activeMQDestination.getPhysicalName());
 
-        } else if (activeMQDestination.getDestinationType() == 2 || 
activeMQDestination.getDestinationType() == 6) {
+        } else if (activeMQDestination.getDestinationType() == TOPIC_TYPE || 
activeMQDestination.getDestinationType() == TEMP_TOPIC_TYPE) {
             activeSpan = ContextManager.createExitSpan(OPERATE_NAME_PREFIX + 
"Topic/" + activeMQDestination.getPhysicalName() + 
PRODUCER_OPERATE_NAME_SUFFIX, contextCarrier, url);
             Tags.MQ_BROKER.set(activeSpan, url);
             
Tags.MQ_TOPIC.set(activeSpan,activeMQDestination.getPhysicalName());
@@ -78,4 +82,4 @@ public class ActiveMQProducerInterceptor implements 
InstanceMethodsAroundInterce
     public void handleMethodException(EnhancedInstance objInst, Method method, 
Object[] allArguments, Class<?>[] argumentsTypes, Throwable t) {
         ContextManager.activeSpan().errorOccurred().log(t);
     }
-}
\ No newline at end of file
+}

Reply via email to