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 19acf56bfc90de7b12feaaaad66216556f86014e..37d1d00804d5c5ff8ed81c683aae6bd3fe3c1c8c 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 +}