use of com.alipay.common.tracer.core.context.trace.SofaTraceContext in project sofa-boot by sofastack.
the class ZipkinSofaTracerSpanRemoteReporterTest method mockRemoteCall.
public void mockRemoteCall() throws Exception {
SofaTraceContext sofaTraceContext = SofaTraceContextHolder.getSofaTraceContext();
SofaTracerSpan originSofaTracerSpan = sofaTraceContext.getCurrentSpan();
SofaTracerSpanContext spanContext = originSofaTracerSpan.getSofaTracerSpanContext();
sofaTraceContext.clear();
// sr
SofaTracerSpan srSpan = this.remoteTracer.serverReceive(spanContext);
srSpan.setOperationName("ServerReceive1");
assertEquals(srSpan, sofaTraceContext.getCurrentSpan());
// ss
this.remoteTracer.serverSend("0");
assertTrue(sofaTraceContext.getThreadLocalSpanSize() == 0);
// mock restore
sofaTraceContext.push(originSofaTracerSpan);
}
Aggregations