[Bug #9598] Apache ShenYu agent Tid is null (#309)

This commit is contained in:
Lisandro 2022-09-15 08:02:25 +08:00 committed by GitHub
parent 9362f87bac
commit 3f88d735ba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View File

@ -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

View File

@ -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(