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 2023/02/23 07:36:05 UTC
[skywalking-java] branch main updated: Fix servicecomb plugin trace break in cse case (#460)
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 20c8b98cd9 Fix servicecomb plugin trace break in cse case (#460)
20c8b98cd9 is described below
commit 20c8b98cd9a37ae8a0dce3f45927a947d93361de
Author: Chenfx-git <68...@users.noreply.github.com>
AuthorDate: Thu Feb 23 15:35:59 2023 +0800
Fix servicecomb plugin trace break in cse case (#460)
---
CHANGES.md | 1 +
.../servicecomb/v2/ProducerOperationHandlerInterceptor.java | 9 ++++++++-
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/CHANGES.md b/CHANGES.md
index 23f4db54dc..da8a191f21 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -16,6 +16,7 @@ Release Notes.
* Refactor kotlin coroutine plugin with CoroutineContext.
* Fix OracleURLParser ignoring actual port when :SID is absent.
* Change gRPC instrumentation point to fix plugin not working for server side.
+* Fix servicecomb plugin trace break.
#### Documentation
* Update docs of Tracing APIs, reorganize the API docs into six parts.
diff --git a/apm-sniffer/apm-sdk-plugin/servicecomb-plugin/servicecomb-java-chassis-2.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/servicecomb/v2/ProducerOperationHandlerInterceptor.java b/apm-sniffer/apm-sdk-plugin/servicecomb-plugin/servicecomb-java-chassis-2.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/servicecomb/v2/ProducerOperationHandlerInterceptor.java
index bbd620f40d..4fe3d6f2cb 100644
--- a/apm-sniffer/apm-sdk-plugin/servicecomb-plugin/servicecomb-java-chassis-2.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/servicecomb/v2/ProducerOperationHandlerInterceptor.java
+++ b/apm-sniffer/apm-sdk-plugin/servicecomb-plugin/servicecomb-java-chassis-2.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/servicecomb/v2/ProducerOperationHandlerInterceptor.java
@@ -42,7 +42,14 @@ public class ProducerOperationHandlerInterceptor implements InstanceMethodsAroun
CarrierItem next = contextCarrier.items();
while (next.hasNext()) {
next = next.next();
- next.setHeadValue(invocation.getContext().get(next.getHeadKey()));
+ String headKey = next.getHeadKey();
+ if (invocation.getContext().containsKey(headKey)) {
+ // cse invoke scenario
+ next.setHeadValue(invocation.getContext().get(headKey));
+ } else {
+ // not cse invoke scenario
+ next.setHeadValue(invocation.getRequestEx().getHeader(headKey));
+ }
}
String operationName = invocation.getMicroserviceQualifiedName();
AbstractSpan span = ContextManager.createEntrySpan(operationName, contextCarrier);