From 05b25f7b74ec97ce49c8102e12f9a4e843e4af6d Mon Sep 17 00:00:00 2001 From: XiaoFu Date: Sun, 5 Aug 2018 08:47:28 +0800 Subject: [PATCH] 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 e0a6653cd1..be81bf58f1 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()); -- GitLab