shenyu plugin fix IgnoredTracerContext traceId NPE (#215)
This commit is contained in:
parent
8de87f5556
commit
dacdddb1b4
|
|
@ -4,7 +4,7 @@ Release Notes.
|
|||
|
||||
8.12.0
|
||||
------------------
|
||||
|
||||
* Fix `Shenyu plugin`'s NPE in reading read trace ID when IgnoredTracerContext is used in the context.
|
||||
|
||||
#### Documentation
|
||||
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ import org.apache.skywalking.apm.agent.core.context.CarrierItem;
|
|||
import org.apache.skywalking.apm.agent.core.context.ContextCarrier;
|
||||
import org.apache.skywalking.apm.agent.core.context.ContextManager;
|
||||
import org.apache.skywalking.apm.agent.core.context.ContextSnapshot;
|
||||
import org.apache.skywalking.apm.agent.core.context.ids.DistributedTraceId;
|
||||
import org.apache.skywalking.apm.agent.core.context.tag.Tags;
|
||||
import org.apache.skywalking.apm.agent.core.context.tag.Tags.HTTP;
|
||||
import org.apache.skywalking.apm.agent.core.context.trace.AbstractSpan;
|
||||
|
|
@ -75,7 +76,8 @@ public class GlobalPluginExecuteMethodInterceptor implements InstanceMethodsArou
|
|||
HTTP.METHOD.set(span, exchange.getRequest().getMethodValue());
|
||||
|
||||
ContextSnapshot snapshot = ContextManager.capture();
|
||||
exchange.getAttributes().put(SHENYU_AGENT_TRACE_ID, snapshot.getTraceId().getId());
|
||||
exchange.getAttributes().put(SHENYU_AGENT_TRACE_ID,
|
||||
Optional.ofNullable(snapshot.getTraceId()).map(DistributedTraceId::getId).orElse(""));
|
||||
EnhancedInstance instance = getInstance(allArguments[0]);
|
||||
instance.setSkyWalkingDynamicField(snapshot);
|
||||
span.prepareForAsync();
|
||||
|
|
|
|||
Loading…
Reference in New Issue