Skip to content

Commit 20c8b98

Browse files
authored
Fix servicecomb plugin trace break in cse case (#460)
1 parent 92af19c commit 20c8b98

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ Release Notes.
1616
* Refactor kotlin coroutine plugin with CoroutineContext.
1717
* Fix OracleURLParser ignoring actual port when :SID is absent.
1818
* Change gRPC instrumentation point to fix plugin not working for server side.
19+
* Fix servicecomb plugin trace break.
1920

2021
#### Documentation
2122
* Update docs of Tracing APIs, reorganize the API docs into six parts.

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,14 @@ public void beforeMethod(EnhancedInstance objInst, Method method, Object[] allAr
4242
CarrierItem next = contextCarrier.items();
4343
while (next.hasNext()) {
4444
next = next.next();
45-
next.setHeadValue(invocation.getContext().get(next.getHeadKey()));
45+
String headKey = next.getHeadKey();
46+
if (invocation.getContext().containsKey(headKey)) {
47+
// cse invoke scenario
48+
next.setHeadValue(invocation.getContext().get(headKey));
49+
} else {
50+
// not cse invoke scenario
51+
next.setHeadValue(invocation.getRequestEx().getHeader(headKey));
52+
}
4653
}
4754
String operationName = invocation.getMicroserviceQualifiedName();
4855
AbstractSpan span = ContextManager.createEntrySpan(operationName, contextCarrier);

0 commit comments

Comments
 (0)