You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@skywalking.apache.org by wu...@apache.org on 2018/08/05 00:47:30 UTC

[incubator-skywalking] branch master updated: Update ActiveMQConsumerInterceptor.java (#1523)

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 29c0a97  Update ActiveMQConsumerInterceptor.java (#1523)
29c0a97 is described below

commit 29c0a9725135ee0138dada6a82e13664dd09690c
Author: XiaoFu <wi...@yeah.net>
AuthorDate: Sun Aug 5 08:47:28 2018 +0800

    Update ActiveMQConsumerInterceptor.java (#1523)
---
 .../apm/plugin/activemq/ActiveMQConsumerInterceptor.java          | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/apm-sniffer/apm-sdk-plugin/activemq-5.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/activemq/ActiveMQConsumerInterceptor.java b/apm-sniffer/apm-sdk-plugin/activemq-5.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/activemq/ActiveMQConsumerInterceptor.java
index e0a6653..be81bf5 100644
--- a/apm-sniffer/apm-sdk-plugin/activemq-5.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/activemq/ActiveMQConsumerInterceptor.java
+++ b/apm-sniffer/apm-sdk-plugin/activemq-5.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/activemq/ActiveMQConsumerInterceptor.java
@@ -39,17 +39,21 @@ public class ActiveMQConsumerInterceptor implements InstanceMethodsAroundInterce
 
     public static final String OPERATE_NAME_PREFIX = "ActiveMQ/";
     public static final String CONSUMER_OPERATE_NAME_SUFFIX = "/Consumer";
+    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 {
         ContextCarrier contextCarrier = new ContextCarrier();
         String url = (String) objInst.getSkyWalkingDynamicField();
         MessageDispatch messageDispatch = (MessageDispatch) allArguments[0];
         AbstractSpan activeSpan = null;
-        if (messageDispatch.getDestination().getDestinationType() == 1 ||  messageDispatch.getDestination().getDestinationType() == 5) {
+        if (messageDispatch.getDestination().getDestinationType() == QUEUE_TYPE ||  messageDispatch.getDestination().getDestinationType() == TEMP_QUEUE_TYPE) {
             activeSpan = ContextManager.createEntrySpan(OPERATE_NAME_PREFIX + "Queue/" + messageDispatch.getDestination().getPhysicalName() + CONSUMER_OPERATE_NAME_SUFFIX, null).start(System.currentTimeMillis());
             Tags.MQ_BROKER.set(activeSpan, url);
             Tags.MQ_QUEUE.set(activeSpan, messageDispatch.getDestination().getPhysicalName());
-        } else if (messageDispatch.getDestination().getDestinationType() == 2 ||  messageDispatch.getDestination().getDestinationType() == 6) {
+        } else if (messageDispatch.getDestination().getDestinationType() == TOPIC_TYPE ||  messageDispatch.getDestination().getDestinationType() == TEMP_TOPIC_TYPE) {
             activeSpan = ContextManager.createEntrySpan(OPERATE_NAME_PREFIX + "Topic/" + messageDispatch.getDestination().getPhysicalName() + CONSUMER_OPERATE_NAME_SUFFIX, null).start(System.currentTimeMillis());
             Tags.MQ_BROKER.set(activeSpan, url);
             Tags.MQ_TOPIC.set(activeSpan, messageDispatch.getDestination().getPhysicalName());