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 3f88d735ba [Bug #9598] Apache ShenYu agent Tid is null (#309)
3f88d735ba is described below

commit 3f88d735ba2bfd1196aff946502447d4b14450c8
Author: Lisandro <[email protected]>
AuthorDate: Thu Sep 15 08:02:25 2022 +0800

    [Bug #9598] Apache ShenYu agent Tid is null (#309)
---
 CHANGES.md                                                           | 1 +
 .../apm/plugin/shenyu/v24x/GlobalPluginExecuteMethodInterceptor.java | 5 +++--
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/CHANGES.md b/CHANGES.md
index bcd3a46f2c..830f16edd2 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -11,6 +11,7 @@ Release Notes.
 * Support to set the value of Map/List field to an empty map/list.
 * Add plugin to support [Impala 
JDBC](https://www.cloudera.com/downloads/connectors/impala/jdbc/2-6-29.html) 
2.6.x.
 * Update guava-cache, jedis, memcached, ehcache plugins to adopt uniform tags.
+* Fix `Apache ShenYu` plugin traceId empty string value. 
 
 #### Documentation
 
diff --git 
a/apm-sniffer/optional-plugins/shenyu-2.4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/shenyu/v24x/GlobalPluginExecuteMethodInterceptor.java
 
b/apm-sniffer/optional-plugins/shenyu-2.4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/shenyu/v24x/GlobalPluginExecuteMethodInterceptor.java
index b259608f07..45004bb04e 100644
--- 
a/apm-sniffer/optional-plugins/shenyu-2.4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/shenyu/v24x/GlobalPluginExecuteMethodInterceptor.java
+++ 
b/apm-sniffer/optional-plugins/shenyu-2.4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/shenyu/v24x/GlobalPluginExecuteMethodInterceptor.java
@@ -77,7 +77,7 @@ public class GlobalPluginExecuteMethodInterceptor implements 
InstanceMethodsArou
 
         ContextSnapshot snapshot = ContextManager.capture();
         exchange.getAttributes().put(SHENYU_AGENT_TRACE_ID,
-                
Optional.ofNullable(snapshot.getTraceId()).map(DistributedTraceId::getId).orElse(""));
+                
Optional.ofNullable(snapshot.getTraceId()).map(DistributedTraceId::getId).orElse(ContextManager.getGlobalTraceId()));
         EnhancedInstance instance = getInstance(allArguments[0]);
         instance.setSkyWalkingDynamicField(snapshot);
         span.prepareForAsync();
@@ -98,7 +98,8 @@ public class GlobalPluginExecuteMethodInterceptor implements 
InstanceMethodsArou
         }
         Mono<Void> monoReturn = (Mono<Void>) ret;
 
-        // add skywalking context snapshot to reactor context. webclient 
plugin need to use SKYWALKING_CONTEXT_SNAPSHOT
+        // add skywalking context snapshot to reactor context.
+        // webclient plugin need to use SKYWALKING_CONTEXT_SNAPSHOT
         EnhancedInstance instance = getInstance(allArguments[0]);
         if (instance != null && instance.getSkyWalkingDynamicField() != null) {
             monoReturn = monoReturn.subscriberContext(

Reply via email to