You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by wu...@apache.org on 2022/10/23 06:27:00 UTC

[skywalking-java] branch main updated: Polish up activemq plugin to fix missing broker tag on consumer side (#363)

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

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


The following commit(s) were added to refs/heads/main by this push:
     new 1148ec3801 Polish up activemq plugin to fix missing broker tag on consumer side (#363)
1148ec3801 is described below

commit 1148ec3801179c005304ae96dd76d7eac1cbfafa
Author: pg.yang <pg...@hotmail.com>
AuthorDate: Sun Oct 23 14:26:54 2022 +0800

    Polish up activemq plugin to fix missing broker tag on consumer side (#363)
---
 CHANGES.md                                         |   2 +
 ...java => MessageConsumerDequeueInterceptor.java} |  55 +++++---
 .../define/ActiveMQConsumerInstrumentation.java    |   4 +-
 ... => MessageConsumerDequeueInterceptorTest.java} |  33 +----
 .../setup/service-agent/java-agent/Plugin-test.md  |  11 +-
 test/plugin/agent-test-tools/pom.xml               |   2 +-
 .../activemq-scenario/config/expectedData.yaml     |   6 +-
 .../kafka-scenario/config/expectedData.yaml        |   6 +-
 .../config/expectedData.yaml                       | 150 ++++++++++-----------
 .../rabbitmq-scenario/config/expectedData.yaml     |   6 +-
 10 files changed, 137 insertions(+), 138 deletions(-)

diff --git a/CHANGES.md b/CHANGES.md
index a67ef86363..0c0bdbdbf0 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -19,6 +19,8 @@ Release Notes.
 * Correct the duration of the transaction span for Neo4J 4.x.
 * Plugin-test configuration.yml dependencies support docker service command field
 * Polish up rabbitmq-5.x plugin to fix missing broker tag on consumer side
+* Polish up activemq plugin to fix missing broker tag on consumer side
+* Enhance MQ plugin relative tests to check key tags not blank.
 
 #### Documentation
 
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/MessageConsumerDequeueInterceptor.java
similarity index 67%
rename from apm-sniffer/apm-sdk-plugin/activemq-5.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/activemq/ActiveMQConsumerInterceptor.java
rename to apm-sniffer/apm-sdk-plugin/activemq-5.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/activemq/MessageConsumerDequeueInterceptor.java
index 4ee9162053..868d57fff0 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/MessageConsumerDequeueInterceptor.java
@@ -31,7 +31,7 @@ import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceM
 import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult;
 import org.apache.skywalking.apm.network.trace.component.ComponentsDefine;
 
-public class ActiveMQConsumerInterceptor implements InstanceMethodsAroundInterceptor {
+public class MessageConsumerDequeueInterceptor implements InstanceMethodsAroundInterceptor {
 
     public static final String OPERATE_NAME_PREFIX = "ActiveMQ/";
     public static final String CONSUMER_OPERATE_NAME_SUFFIX = "/Consumer";
@@ -41,28 +41,48 @@ public class ActiveMQConsumerInterceptor implements InstanceMethodsAroundInterce
     public static final byte TEMP_QUEUE_TYPE = 5;
 
     @Override
-    public void beforeMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes,
-        MethodInterceptResult result) throws Throwable {
+    public void beforeMethod(final EnhancedInstance objInst,
+                             final Method method,
+                             final Object[] allArguments,
+                             final Class<?>[] argumentsTypes,
+                             final MethodInterceptResult result) throws Throwable {
+
+    }
+
+    @Override
+    public Object afterMethod(final EnhancedInstance objInst,
+                              final Method method,
+                              final Object[] allArguments,
+                              final Class<?>[] argumentsTypes,
+                              final Object ret) throws Throwable {
+        if (ret == null) {
+            return ret;
+        }
+        MessageDispatch messageDispatch = (MessageDispatch) ret;
         ContextCarrier contextCarrier = new ContextCarrier();
         String url = (String) objInst.getSkyWalkingDynamicField();
-        MessageDispatch messageDispatch = (MessageDispatch) allArguments[0];
         AbstractSpan activeSpan = null;
         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)
+            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() == TOPIC_TYPE || messageDispatch.getDestination()
                                                                                         .getDestinationType() == TEMP_TOPIC_TYPE) {
-            activeSpan = ContextManager.createEntrySpan(OPERATE_NAME_PREFIX + "Topic/" + messageDispatch.getDestination()
-                                                                                                        .getPhysicalName() + CONSUMER_OPERATE_NAME_SUFFIX, null)
+            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());
         }
+        if (activeSpan == null) {
+            return ret;
+        }
         activeSpan.setComponent(ComponentsDefine.ACTIVEMQ_CONSUMER);
         SpanLayer.asMQ(activeSpan);
         CarrierItem next = contextCarrier.items();
@@ -74,20 +94,17 @@ public class ActiveMQConsumerInterceptor implements InstanceMethodsAroundInterce
             }
         }
         ContextManager.extract(contextCarrier);
-
-    }
-
-    @Override
-    public Object afterMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes,
-        Object ret) throws Throwable {
-        ContextManager.stopSpan();
+        // Close span immediately , as no chance to trace anything
+        ContextManager.stopSpan(activeSpan);
         return ret;
-
     }
 
     @Override
-    public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments,
-        Class<?>[] argumentsTypes, Throwable t) {
-        ContextManager.activeSpan().log(t);
+    public void handleMethodException(final EnhancedInstance objInst,
+                                      final Method method,
+                                      final Object[] allArguments,
+                                      final Class<?>[] argumentsTypes,
+                                      final Throwable t) {
+
     }
 }
diff --git a/apm-sniffer/apm-sdk-plugin/activemq-5.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/activemq/define/ActiveMQConsumerInstrumentation.java b/apm-sniffer/apm-sdk-plugin/activemq-5.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/activemq/define/ActiveMQConsumerInstrumentation.java
index 5cd6328a13..f6bf469b69 100644
--- a/apm-sniffer/apm-sdk-plugin/activemq-5.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/activemq/define/ActiveMQConsumerInstrumentation.java
+++ b/apm-sniffer/apm-sdk-plugin/activemq-5.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/activemq/define/ActiveMQConsumerInstrumentation.java
@@ -34,10 +34,10 @@ import static org.apache.skywalking.apm.agent.core.plugin.bytebuddy.ArgumentType
  * org.apache.activemq.ActiveMQMessageConsumer}.
  */
 public class ActiveMQConsumerInstrumentation extends ClassInstanceMethodsEnhancePluginDefine {
-    public static final String INTERCEPTOR_CLASS = "org.apache.skywalking.apm.plugin.activemq.ActiveMQConsumerInterceptor";
+    public static final String INTERCEPTOR_CLASS = "org.apache.skywalking.apm.plugin.activemq.MessageConsumerDequeueInterceptor";
     public static final String ENHANCE_CLASS_CONSUMER = "org.apache.activemq.ActiveMQMessageConsumer";
     public static final String CONSTRUCTOR_INTERCEPTOR_CLASS = "org.apache.skywalking.apm.plugin.activemq.ActiveMQConsumerConstructorInterceptor";
-    public static final String ENHANCE_METHOD_DISPATCH = "dispatch";
+    public static final String ENHANCE_METHOD_DISPATCH = "dequeue";
     public static final String CONSTRUCTOR_INTERCEPT_TYPE = "org.apache.activemq.ActiveMQSession";
 
     @Override
diff --git a/apm-sniffer/apm-sdk-plugin/activemq-5.x-plugin/src/test/java/org/apache/skywalking/apm/plugin/activemq/ActiveMQConsumerInterceptorTest.java b/apm-sniffer/apm-sdk-plugin/activemq-5.x-plugin/src/test/java/org/apache/skywalking/apm/plugin/activemq/MessageConsumerDequeueInterceptorTest.java
similarity index 81%
rename from apm-sniffer/apm-sdk-plugin/activemq-5.x-plugin/src/test/java/org/apache/skywalking/apm/plugin/activemq/ActiveMQConsumerInterceptorTest.java
rename to apm-sniffer/apm-sdk-plugin/activemq-5.x-plugin/src/test/java/org/apache/skywalking/apm/plugin/activemq/MessageConsumerDequeueInterceptorTest.java
index b65f40bb12..8ee87677b8 100644
--- a/apm-sniffer/apm-sdk-plugin/activemq-5.x-plugin/src/test/java/org/apache/skywalking/apm/plugin/activemq/ActiveMQConsumerInterceptorTest.java
+++ b/apm-sniffer/apm-sdk-plugin/activemq-5.x-plugin/src/test/java/org/apache/skywalking/apm/plugin/activemq/MessageConsumerDequeueInterceptorTest.java
@@ -18,7 +18,6 @@
 
 package org.apache.skywalking.apm.plugin.activemq;
 
-import java.io.IOException;
 import java.util.List;
 import javax.jms.JMSException;
 import org.apache.activemq.command.ActiveMQDestination;
@@ -33,7 +32,6 @@ import org.apache.skywalking.apm.agent.test.tools.SegmentStorage;
 import org.apache.skywalking.apm.agent.test.tools.SegmentStoragePoint;
 import org.apache.skywalking.apm.agent.test.tools.TracingSegmentRunner;
 import org.junit.Assert;
-import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -44,7 +42,7 @@ import static org.hamcrest.CoreMatchers.is;
 
 @RunWith(PowerMockRunner.class)
 @PowerMockRunnerDelegate(TracingSegmentRunner.class)
-public class ActiveMQConsumerInterceptorTest {
+public class MessageConsumerDequeueInterceptorTest {
 
     @SegmentStoragePoint
     private SegmentStorage segmentStorage;
@@ -52,14 +50,6 @@ public class ActiveMQConsumerInterceptorTest {
     @Rule
     public AgentServiceRule serviceRule = new AgentServiceRule();
 
-    private ActiveMQConsumerInterceptor activeMQConsumerInterceptor;
-
-    private Object[] arguments;
-
-    private Class[] argumentType;
-
-    private MessageDispatch messageDispatch;
-
     public class Des extends ActiveMQDestination {
 
         @Override
@@ -122,25 +112,14 @@ public class ActiveMQConsumerInterceptorTest {
         }
     };
 
-    @Before
-    public void setUp() throws IOException {
-        activeMQConsumerInterceptor = new ActiveMQConsumerInterceptor();
-        messageDispatch = new MessageDispatch();
-
+    @Test
+    public void testConsumerWithoutMessage() throws Throwable {
+        MessageDispatch  messageDispatch = new MessageDispatch();
         Des des = new Des();
         des.setPhysicalName("test");
         messageDispatch.setDestination(des);
-        Message msg = new Msg();
-        messageDispatch.setMessage(msg);
-        arguments = new Object[] {messageDispatch};
-        argumentType = null;
-    }
-
-    @Test
-    public void testConsumerWithoutMessage() throws Throwable {
-        activeMQConsumerInterceptor.beforeMethod(enhancedInstance, null, arguments, null, null);
-        activeMQConsumerInterceptor.afterMethod(enhancedInstance, null, arguments, null, null);
-
+        messageDispatch.setMessage(new Msg());
+        new MessageConsumerDequeueInterceptor().afterMethod(enhancedInstance, null, new Object[0], null, messageDispatch);
         List<TraceSegment> traceSegments = segmentStorage.getTraceSegments();
         Assert.assertThat(traceSegments.size(), is(1));
     }
diff --git a/docs/en/setup/service-agent/java-agent/Plugin-test.md b/docs/en/setup/service-agent/java-agent/Plugin-test.md
index 55d529d96b..a2df65cd59 100644
--- a/docs/en/setup/service-agent/java-agent/Plugin-test.md
+++ b/docs/en/setup/service-agent/java-agent/Plugin-test.md
@@ -202,11 +202,12 @@ as the version number, which will be changed in the test for each version.
 
 **Operator for String**
 
-| Operator | Description |
-| :--- | :--- |
-| `not null` | Not null |
-| `null` | Null or empty String |
-| `eq` | Equal(default) |
+| Operator    | Description                                                                                                   |
+|:------------|:--------------------------------------------------------------------------------------------------------------|
+| `not null`  | Not null                                                                                                      |
+| `not blank` | Not blank ,it's recommended for String type field as the default value maybe blank string, such as span tags  |
+| `null`      | Null or empty String                                                                                          |
+| `eq`        | Equal(default)                                                                                                |
 
 **Expected Data Format Of The Segment**
 ```yml
diff --git a/test/plugin/agent-test-tools/pom.xml b/test/plugin/agent-test-tools/pom.xml
index c220234504..c817cd03e8 100644
--- a/test/plugin/agent-test-tools/pom.xml
+++ b/test/plugin/agent-test-tools/pom.xml
@@ -35,7 +35,7 @@
     <packaging>pom</packaging>
 
     <properties>
-        <agent-test-tools.version>24270f8f1ee1cb9186ede5202ff1c4ae3d2d482a</agent-test-tools.version>
+        <agent-test-tools.version>7f20775e0631356c4823d9372b09d653db0e6540</agent-test-tools.version>
         <agent-test-tools.workingDirectory>${project.basedir}/target/agent-test-tools</agent-test-tools.workingDirectory>
         <agent-test-tools.repos>https://github.com/apache/skywalking-agent-test-tool.git</agent-test-tools.repos>
     </properties>
diff --git a/test/plugin/scenarios/activemq-scenario/config/expectedData.yaml b/test/plugin/scenarios/activemq-scenario/config/expectedData.yaml
index 918ffb1f56..3d2e17752f 100644
--- a/test/plugin/scenarios/activemq-scenario/config/expectedData.yaml
+++ b/test/plugin/scenarios/activemq-scenario/config/expectedData.yaml
@@ -30,7 +30,7 @@ segmentItems:
       spanType: Exit
       peer: not null
       tags:
-      - {key: mq.broker, value: not null}
+      - {key: mq.broker, value: not blank}
       - {key: mq.queue, value: test}
       skipAnalysis: 'false'
     - operationName: GET:/activemq-scenario/case/activemq
@@ -61,9 +61,9 @@ segmentItems:
       spanType: Entry
       peer: ''
       tags:
-      - {key: mq.broker, value: not null}
+      - {key: mq.broker, value: not blank}
       - {key: mq.queue, value: test}
-      - {key: transmission.latency, value: not null}
+      - {key: transmission.latency, value: ge 0}
       refs:
       - {parentEndpoint: GET:/activemq-scenario/case/activemq, networkAddress: not null,
         refType: CrossProcess, parentSpanId: 1, parentTraceSegmentId: not null,
diff --git a/test/plugin/scenarios/kafka-scenario/config/expectedData.yaml b/test/plugin/scenarios/kafka-scenario/config/expectedData.yaml
index 6d549cb5d8..2f9964f7f1 100644
--- a/test/plugin/scenarios/kafka-scenario/config/expectedData.yaml
+++ b/test/plugin/scenarios/kafka-scenario/config/expectedData.yaml
@@ -162,7 +162,7 @@ segmentItems:
       tags:
       - {key: mq.broker, value: 'kafka-server:9092'}
       - {key: mq.topic, value: test}
-      - {key: transmission.latency, value: not null}
+      - {key: transmission.latency, value: ge 0}
       refs:
       - {parentEndpoint: GET:/case/kafka-case, networkAddress: 'kafka-server:9092', refType: CrossProcess,
         parentSpanId: 1, parentTraceSegmentId: not null, parentServiceInstance: not
@@ -198,8 +198,8 @@ segmentItems:
         tags:
           - {key: mq.broker, value: 'kafka-server:9092'}
           - {key: mq.topic, value: test.}
-          - {key: transmission.latency, value: not null}
-          - {key: transmission.latency, value: not null}
+          - {key: transmission.latency, value: ge 0}
+          - {key: transmission.latency, value: ge 0}
         refs:
           - {parentEndpoint: GET:/case/kafka-case, networkAddress: 'kafka-server:9092', refType: CrossProcess,
              parentSpanId: 2, parentTraceSegmentId: not null, parentServiceInstance: not
diff --git a/test/plugin/scenarios/nats-2.14.x-2.15.x-scenario/config/expectedData.yaml b/test/plugin/scenarios/nats-2.14.x-2.15.x-scenario/config/expectedData.yaml
index facf8d25d3..cb0ac4988c 100644
--- a/test/plugin/scenarios/nats-2.14.x-2.15.x-scenario/config/expectedData.yaml
+++ b/test/plugin/scenarios/nats-2.14.x-2.15.x-scenario/config/expectedData.yaml
@@ -32,8 +32,8 @@ segmentItems:
             peer: ''
             skipAnalysis: false
             tags:
-              - {key: reply_to, value: not null}
-              - {key: mq.queue, value: not null}
+              - {key: reply_to, value: not blank}
+              - {key: mq.queue, value: not blank}
       - segmentId: not null
         spans:
           - operationName: Nats/Pub/$JS.API.STREAM.INFO.scenario-8080-test-stream-3
@@ -49,8 +49,8 @@ segmentItems:
             peer: nats://nats-server:4222
             skipAnalysis: false
             tags:
-              - {key: reply_to, value: not null}
-              - {key: mq.queue, value: not null}
+              - {key: reply_to, value: not blank}
+              - {key: mq.queue, value: not blank}
               - {key: mq.broker, value: 'nats://nats-server:4222'}
 
             refs:
@@ -73,8 +73,8 @@ segmentItems:
             peer: ''
             skipAnalysis: false
             tags:
-              - {key: reply_to, value: not null}
-              - {key: mq.queue, value: not null}
+              - {key: reply_to, value: not blank}
+              - {key: mq.queue, value: not blank}
       - segmentId: not null
         spans:
           - operationName: Nats/Pub/$JS.API.STREAM.CREATE.scenario-8080-test-stream-3
@@ -90,8 +90,8 @@ segmentItems:
             peer: nats://nats-server:4222
             skipAnalysis: false
             tags:
-              - {key: reply_to, value: not null}
-              - {key: mq.queue, value: not null}
+              - {key: reply_to, value: not blank}
+              - {key: mq.queue, value: not blank}
               - {key: mq.broker, value: 'nats://nats-server:4222'}
             refs:
               - {parentEndpoint: Nats/Pub/Enqueue/$JS.API.STREAM.CREATE.scenario-8080-test-stream-3,
@@ -113,8 +113,8 @@ segmentItems:
             peer: ''
             skipAnalysis: false
             tags:
-              - {key: reply_to, value: not null}
-              - {key: mq.queue, value: not null}
+              - {key: reply_to, value: not blank}
+              - {key: mq.queue, value: not blank}
       - segmentId: not null
         spans:
           - operationName: Nats/Pub/$JS.API.CONSUMER.CREATE.scenario-8080-test-stream-3
@@ -130,8 +130,8 @@ segmentItems:
             peer: nats://nats-server:4222
             skipAnalysis: false
             tags:
-              - {key: reply_to, value: not null}
-              - {key: mq.queue, value: not null}
+              - {key: reply_to, value: not blank}
+              - {key: mq.queue, value: not blank}
               - {key: mq.broker, value: 'nats://nats-server:4222'}
             refs:
               - {parentEndpoint: Nats/Pub/Enqueue/$JS.API.CONSUMER.CREATE.scenario-8080-test-stream-3,
@@ -153,8 +153,8 @@ segmentItems:
             peer: ''
             skipAnalysis: false
             tags:
-              - {key: reply_to, value: not null}
-              - {key: mq.queue, value: not null}
+              - {key: reply_to, value: not blank}
+              - {key: mq.queue, value: not blank}
       - segmentId: not null
         spans:
           - operationName: Nats/Pub/$JS.API.STREAM.INFO.scenario-8080-test-stream-4
@@ -170,8 +170,8 @@ segmentItems:
             peer: nats://nats-server:4222
             skipAnalysis: false
             tags:
-              - {key: reply_to, value: not null}
-              - {key: mq.queue, value: not null}
+              - {key: reply_to, value: not blank}
+              - {key: mq.queue, value: not blank}
               - {key: mq.broker, value: 'nats://nats-server:4222'}
             refs:
               - {parentEndpoint: Nats/Pub/Enqueue/$JS.API.STREAM.INFO.scenario-8080-test-stream-4,
@@ -193,8 +193,8 @@ segmentItems:
             peer: ''
             skipAnalysis: false
             tags:
-              - {key: reply_to, value: not null}
-              - {key: mq.queue, value: not null}
+              - {key: reply_to, value: not blank}
+              - {key: mq.queue, value: not blank}
       - segmentId: not null
         spans:
           - operationName: Nats/Pub/$JS.API.STREAM.CREATE.scenario-8080-test-stream-4
@@ -210,8 +210,8 @@ segmentItems:
             peer: nats://nats-server:4222
             skipAnalysis: false
             tags:
-              - {key: reply_to, value: not null}
-              - {key: mq.queue, value: not null}
+              - {key: reply_to, value: not blank}
+              - {key: mq.queue, value: not blank}
               - {key: mq.broker, value: 'nats://nats-server:4222'}
             refs:
               - {parentEndpoint: Nats/Pub/Enqueue/$JS.API.STREAM.CREATE.scenario-8080-test-stream-4,
@@ -233,8 +233,8 @@ segmentItems:
             peer: nats://nats-server:4222
             skipAnalysis: false
             tags:
-              - {key: reply_to, value: not null}
-              - {key: mq.queue, value: not null}
+              - {key: reply_to, value: not blank}
+              - {key: mq.queue, value: not blank}
               - {key: mq.broker, value: 'nats://nats-server:4222'}
             refs:
               - {parentEndpoint: Nats/Pub/Enqueue/$JS.API.STREAM.NAMES, networkAddress: '',
@@ -256,8 +256,8 @@ segmentItems:
             peer: ''
             skipAnalysis: false
             tags:
-              - {key: reply_to, value: not null}
-              - {key: mq.queue, value: not null}
+              - {key: reply_to, value: not blank}
+              - {key: mq.queue, value: not blank}
       - segmentId: not null
         spans:
           - operationName: Nats/Pub/Enqueue/$JS.API.STREAM.NAMES
@@ -273,8 +273,8 @@ segmentItems:
             peer: ''
             skipAnalysis: false
             tags:
-              - {key: reply_to, value: not null}
-              - {key: mq.queue, value: not null}
+              - {key: reply_to, value: not blank}
+              - {key: mq.queue, value: not blank}
       - segmentId: not null
         spans:
           - operationName: Nats/Pub/$JS.API.CONSUMER.INFO.scenario-8080-test-stream-4.scenario-8080-test-stream-4-durable
@@ -290,8 +290,8 @@ segmentItems:
             peer: nats://nats-server:4222
             skipAnalysis: false
             tags:
-              - {key: reply_to, value: not null}
-              - {key: mq.queue, value: not null}
+              - {key: reply_to, value: not blank}
+              - {key: mq.queue, value: not blank}
               - {key: mq.broker, value: 'nats://nats-server:4222'}
             refs:
               - {parentEndpoint: Nats/Pub/Enqueue/$JS.API.CONSUMER.INFO.scenario-8080-test-stream-4.scenario-8080-test-stream-4-durable,
@@ -313,8 +313,8 @@ segmentItems:
             peer: ''
             skipAnalysis: false
             tags:
-              - {key: reply_to, value: not null}
-              - {key: mq.queue, value: not null}
+              - {key: reply_to, value: not blank}
+              - {key: mq.queue, value: not blank}
       - segmentId: not null
         spans:
           - operationName: Nats/Pub/$JS.API.CONSUMER.DURABLE.CREATE.scenario-8080-test-stream-4.scenario-8080-test-stream-4-durable
@@ -330,8 +330,8 @@ segmentItems:
             peer: nats://nats-server:4222
             skipAnalysis: false
             tags:
-              - {key: reply_to, value: not null}
-              - {key: mq.queue, value: not null}
+              - {key: reply_to, value: not blank}
+              - {key: mq.queue, value: not blank}
               - {key: mq.broker, value: 'nats://nats-server:4222'}
             refs:
               - {parentEndpoint: Nats/Pub/Enqueue/$JS.API.CONSUMER.DURABLE.CREATE.scenario-8080-test-stream-4.scenario-8080-test-stream-4-durable,
@@ -353,8 +353,8 @@ segmentItems:
             peer: nats://nats-server:4222
             skipAnalysis: false
             tags:
-              - {key: reply_to, value: not null}
-              - {key: mq.queue, value: not null}
+              - {key: reply_to, value: not blank}
+              - {key: mq.queue, value: not blank}
               - {key: mq.broker, value: 'nats://nats-server:4222'}
             refs:
               - {parentEndpoint: Nats/Pub/Enqueue/$JS.API.CONSUMER.MSG.NEXT.scenario-8080-test-stream-4.scenario-8080-test-stream-4-durable,
@@ -376,8 +376,8 @@ segmentItems:
             peer: ''
             skipAnalysis: false
             tags:
-              - {key: reply_to, value: not null}
-              - {key: mq.queue, value: not null}
+              - {key: reply_to, value: not blank}
+              - {key: mq.queue, value: not blank}
       - segmentId: not null
         spans:
           - operationName: HEAD:/nats/check
@@ -411,7 +411,7 @@ segmentItems:
             peer: nats://nats-server:4222
             skipAnalysis: false
             tags:
-              - {key: mq.queue, value: not null}
+              - {key: mq.queue, value: not blank}
               - {key: mq.broker, value: 'nats://nats-server:4222'}
             refs:
               - {parentEndpoint: 'GET:/nats/start', networkAddress: '', refType: CrossThread,
@@ -433,9 +433,9 @@ segmentItems:
             peer: ''
             skipAnalysis: false
             tags:
-              - {key: transmission.latency, value: not null}
+              - {key: transmission.latency, value: ge 0}
               - {key: sid, value: '1'}
-              - {key: mq.queue, value: not null}
+              - {key: mq.queue, value: not blank}
               - {key: mq.broker, value: 'nats://nats-server:4222'}
             refs:
               - {parentEndpoint: Nats/Pub/scenario-8080-subject-1, networkAddress: 'nats://nats-server:4222',
@@ -457,8 +457,8 @@ segmentItems:
             peer: nats://nats-server:4222
             skipAnalysis: false
             tags:
-              - {key: reply_to, value: not null}
-              - {key: mq.queue, value: not null}
+              - {key: reply_to, value: not blank}
+              - {key: mq.queue, value: not blank}
               - {key: mq.broker, value: 'nats://nats-server:4222'}
             refs:
               - {parentEndpoint: 'GET:/nats/start', networkAddress: '', refType: CrossThread,
@@ -480,7 +480,7 @@ segmentItems:
             peer: nats://nats-server:4222
             skipAnalysis: false
             tags:
-              - {key: mq.queue, value: not null}
+              - {key: mq.queue, value: not blank}
               - {key: mq.broker, value: 'nats://nats-server:4222'}
             refs:
               - {parentEndpoint: Nats/Sub/scenario-8080-subject-2, networkAddress: '', refType: CrossThread,
@@ -502,7 +502,7 @@ segmentItems:
             peer: ''
             skipAnalysis: false
             tags:
-              - {key: mq.queue, value: not null}
+              - {key: mq.queue, value: not blank}
 
           - operationName: Nats/Sub/scenario-8080-subject-2
             operationId: 0
@@ -517,10 +517,10 @@ segmentItems:
             peer: ''
             skipAnalysis: false
             tags:
-              - {key: transmission.latency, value: not null}
-              - {key: reply_to, value: not null}
+              - {key: transmission.latency, value: ge 0}
+              - {key: reply_to, value: not blank}
               - {key: sid, value: '1'}
-              - {key: mq.queue, value: not null}
+              - {key: mq.queue, value: not blank}
               - {key: mq.broker, value: 'nats://nats-server:4222'}
             refs:
               - {parentEndpoint: Nats/Pub/scenario-8080-subject-2, networkAddress: 'nats://nats-server:4222',
@@ -542,9 +542,9 @@ segmentItems:
             peer: ''
             skipAnalysis: false
             tags:
-              - {key: transmission.latency, value: not null}
+              - {key: transmission.latency, value: ge 0}
               - {key: sid, value: '1'}
-              - {key: mq.queue, value: not null}
+              - {key: mq.queue, value: not blank}
               - {key: mq.broker, value: 'nats://nats-server:4222'}
             refs:
               - {parentEndpoint: not null,
@@ -567,8 +567,8 @@ segmentItems:
             peer: nats://nats-server:4222
             skipAnalysis: false
             tags:
-              - {key: reply_to, value: not null}
-              - {key: mq.queue, value: not null}
+              - {key: reply_to, value: not blank}
+              - {key: mq.queue, value: not blank}
               - {key: mq.broker, value: 'nats://nats-server:4222'}
             refs:
               - {parentEndpoint: 'GET:/nats/start', networkAddress: '', refType: CrossThread,
@@ -590,7 +590,7 @@ segmentItems:
             peer: ''
             skipAnalysis: false
             tags:
-              - {key: mq.queue, value: not null}
+              - {key: mq.queue, value: not blank}
 
           - operationName: Nats/Sub/scenario-8080-subject-3
             operationId: 0
@@ -605,10 +605,10 @@ segmentItems:
             peer: ''
             skipAnalysis: false
             tags:
-              - {key: transmission.latency, value: not null}
-              - {key: reply_to, value: not null}
+              - {key: transmission.latency, value: ge 0}
+              - {key: reply_to, value: not blank}
               - {key: sid, value: '2'}
-              - {key: mq.queue, value: not null}
+              - {key: mq.queue, value: not blank}
               - {key: mq.broker, value: 'nats://nats-server:4222'}
 
             refs:
@@ -631,7 +631,7 @@ segmentItems:
             peer: nats://nats-server:4222
             skipAnalysis: false
             tags:
-              - {key: mq.queue, value: not null}
+              - {key: mq.queue, value: not blank}
               - {key: mq.broker, value: 'nats://nats-server:4222'}
             refs:
               - {parentEndpoint: Nats/Sub/scenario-8080-subject-3, networkAddress: '', refType: CrossThread,
@@ -653,8 +653,8 @@ segmentItems:
             peer: nats://nats-server:4222
             skipAnalysis: false
             tags:
-              - {key: reply_to, value: not null}
-              - {key: mq.queue, value: not null}
+              - {key: reply_to, value: not blank}
+              - {key: mq.queue, value: not blank}
               - {key: mq.broker, value: 'nats://nats-server:4222'}
             refs:
               - {parentEndpoint: 'GET:/nats/start', networkAddress: '', refType: CrossThread,
@@ -676,8 +676,8 @@ segmentItems:
             peer: nats://nats-server:4222
             skipAnalysis: false
             tags:
-              - {key: reply_to, value: not null}
-              - {key: mq.queue, value: not null}
+              - {key: reply_to, value: not blank}
+              - {key: mq.queue, value: not blank}
               - {key: mq.broker, value: 'nats://nats-server:4222'}
             refs:
               - {parentEndpoint: 'GET:/nats/start', networkAddress: '', refType: CrossThread,
@@ -699,10 +699,10 @@ segmentItems:
             peer: ''
             skipAnalysis: false
             tags:
-              - {key: transmission.latency, value: not null}
-              - {key: reply_to, value: not null}
+              - {key: transmission.latency, value: ge 0}
+              - {key: reply_to, value: not blank}
               - {key: sid, value: '2'}
-              - {key: mq.queue, value: not null}
+              - {key: mq.queue, value: not blank}
               - {key: mq.broker, value: 'nats://nats-server:4222'}
             refs:
               - {parentEndpoint: Nats/Pub/scenario-8080-subject-4, networkAddress: 'nats://nats-server:4222',
@@ -724,7 +724,7 @@ segmentItems:
             peer: ''
             skipAnalysis: false
             tags:
-              - {key: mq.queue, value: not null}
+              - {key: mq.queue, value: not blank}
           - operationName: Nats/Pub/Enqueue/scenario-8080-subject-2
             operationId: 0
             parentSpanId: 0
@@ -738,8 +738,8 @@ segmentItems:
             peer: ''
             skipAnalysis: false
             tags:
-              - {key: reply_to, value: not null}
-              - {key: mq.queue, value: not null}
+              - {key: reply_to, value: not blank}
+              - {key: mq.queue, value: not blank}
 
           - operationName: Nats/Pub/Enqueue/$JS.API.STREAM.INFO.scenario-8080-test-stream-3
             operationId: 0
@@ -754,8 +754,8 @@ segmentItems:
             peer: ''
             skipAnalysis: false
             tags:
-              - {key: reply_to, value: not null}
-              - {key: mq.queue, value: not null}
+              - {key: reply_to, value: not blank}
+              - {key: mq.queue, value: not blank}
           - operationName: Nats/Pub/Enqueue/scenario-8080-subject-3
             operationId: 0
             parentSpanId: 0
@@ -769,8 +769,8 @@ segmentItems:
             peer: ''
             skipAnalysis: false
             tags:
-              - {key: reply_to, value: not null}
-              - {key: mq.queue, value: not null}
+              - {key: reply_to, value: not blank}
+              - {key: mq.queue, value: not blank}
           - operationName: Nats/Pub/Enqueue/$JS.API.STREAM.INFO.scenario-8080-test-stream-4
             operationId: 0
             parentSpanId: 0
@@ -784,8 +784,8 @@ segmentItems:
             peer: ''
             skipAnalysis: false
             tags:
-              - {key: reply_to, value: not null}
-              - {key: mq.queue, value: not null}
+              - {key: reply_to, value: not blank}
+              - {key: mq.queue, value: not blank}
           - operationName: Nats/Pub/Enqueue/scenario-8080-subject-4
             operationId: 0
             parentSpanId: 0
@@ -799,8 +799,8 @@ segmentItems:
             peer: ''
             skipAnalysis: false
             tags:
-              - {key: reply_to, value: not null}
-              - {key: mq.queue, value: not null}
+              - {key: reply_to, value: not blank}
+              - {key: mq.queue, value: not blank}
           - operationName: GET:/nats/start
             operationId: 0
             parentSpanId: -1
@@ -832,8 +832,8 @@ segmentItems:
             peer: nats://nats-server:4222
             skipAnalysis: false
             tags:
-              - {key: reply_to, value: not null}
-              - {key: mq.queue, value: not null}
+              - {key: reply_to, value: not blank}
+              - {key: mq.queue, value: not blank}
               - {key: mq.broker, value: 'nats://nats-server:4222'}
             refs:
               - {parentEndpoint: 'GET:/nats/start', networkAddress: '', refType: CrossThread,
diff --git a/test/plugin/scenarios/rabbitmq-scenario/config/expectedData.yaml b/test/plugin/scenarios/rabbitmq-scenario/config/expectedData.yaml
index ba35bc8613..8ce7fb0d36 100644
--- a/test/plugin/scenarios/rabbitmq-scenario/config/expectedData.yaml
+++ b/test/plugin/scenarios/rabbitmq-scenario/config/expectedData.yaml
@@ -30,10 +30,10 @@ segmentItems:
       spanType: Entry
       peer: ''
       tags:
-      - {key: mq.broker, value: not null}
+      - {key: mq.broker, value: not blank}
       - {key: mq.topic, value: ''}
       - {key: mq.queue, value: test}
-      - {key: transmission.latency, value: not null}
+      - {key: transmission.latency, value: ge 0}
       refs:
       - {parentEndpoint: GET:/rabbitmq-scenario/case/rabbitmq, networkAddress: not null,
         refType: CrossProcess, parentSpanId: 1, parentTraceSegmentId: not null, parentServiceInstance: not
@@ -52,7 +52,7 @@ segmentItems:
       spanType: Exit
       peer: not null
       tags:
-      - {key: mq.broker, value: not null}
+      - {key: mq.broker, value: not blank}
       - {key: mq.queue, value: test}
       - {key: mq.topic, value: ''}
       skipAnalysis: 'false'