提交 57b69fb8 编写于 作者: wu-sheng's avatar wu-sheng

Support #299 and #301

上级 7a91ef7a
...@@ -33,6 +33,8 @@ message TraceSegmentReference { ...@@ -33,6 +33,8 @@ message TraceSegmentReference {
int32 networkAddressId = 6; int32 networkAddressId = 6;
string entryServiceName = 7; string entryServiceName = 7;
int32 entryServiceId = 8; int32 entryServiceId = 8;
string parentServiceName = 9;
int32 parentServiceId = 10;
} }
message SpanObject { message SpanObject {
......
...@@ -28,6 +28,8 @@ public class ContextCarrier implements Serializable { ...@@ -28,6 +28,8 @@ public class ContextCarrier implements Serializable {
private String entryOperationName; private String entryOperationName;
private String parentOperationName;
/** /**
* {@link DistributedTraceId} * {@link DistributedTraceId}
*/ */
...@@ -47,7 +49,8 @@ public class ContextCarrier implements Serializable { ...@@ -47,7 +49,8 @@ public class ContextCarrier implements Serializable {
this.getApplicationInstanceId() + "", this.getApplicationInstanceId() + "",
this.getPeerHost(), this.getPeerHost(),
this.getEntryOperationName(), this.getEntryOperationName(),
this.serializeDistributedTraceId()); this.getParentOperationName(),
this.getPrimaryDistributedTraceId());
} else { } else {
return ""; return "";
} }
...@@ -60,15 +63,16 @@ public class ContextCarrier implements Serializable { ...@@ -60,15 +63,16 @@ public class ContextCarrier implements Serializable {
*/ */
public ContextCarrier deserialize(String text) { public ContextCarrier deserialize(String text) {
if (text != null) { if (text != null) {
String[] parts = text.split("\\|", 6); String[] parts = text.split("\\|", 7);
if (parts.length == 6) { if (parts.length == 7) {
try { try {
this.traceSegmentId = parts[0]; this.traceSegmentId = parts[0];
this.spanId = Integer.parseInt(parts[1]); this.spanId = Integer.parseInt(parts[1]);
this.applicationInstanceId = Integer.parseInt(parts[2]); this.applicationInstanceId = Integer.parseInt(parts[2]);
this.peerHost = parts[3]; this.peerHost = parts[3];
this.entryOperationName = parts[4]; this.entryOperationName = parts[4];
this.primaryDistributedTraceId = new PropagatedTraceId(parts[5]); this.parentOperationName = parts[5];
this.primaryDistributedTraceId = new PropagatedTraceId(parts[6]);
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
} }
...@@ -88,6 +92,7 @@ public class ContextCarrier implements Serializable { ...@@ -88,6 +92,7 @@ public class ContextCarrier implements Serializable {
&& applicationInstanceId != DictionaryUtil.nullValue() && applicationInstanceId != DictionaryUtil.nullValue()
&& !StringUtil.isEmpty(peerHost) && !StringUtil.isEmpty(peerHost)
&& !StringUtil.isEmpty(entryOperationName) && !StringUtil.isEmpty(entryOperationName)
&& !StringUtil.isEmpty(parentOperationName)
&& primaryDistributedTraceId != null; && primaryDistributedTraceId != null;
} }
...@@ -103,6 +108,14 @@ public class ContextCarrier implements Serializable { ...@@ -103,6 +108,14 @@ public class ContextCarrier implements Serializable {
this.entryOperationName = entryOperationId + ""; this.entryOperationName = entryOperationId + "";
} }
void setParentOperationName(String parentOperationName) {
this.parentOperationName = '#' + parentOperationName;
}
void setParentOperationId(int parentOperationId) {
this.parentOperationName = parentOperationId + "";
}
public String getTraceSegmentId() { public String getTraceSegmentId() {
return traceSegmentId; return traceSegmentId;
} }
...@@ -147,7 +160,11 @@ public class ContextCarrier implements Serializable { ...@@ -147,7 +160,11 @@ public class ContextCarrier implements Serializable {
this.primaryDistributedTraceId = distributedTraceIds.get(0); this.primaryDistributedTraceId = distributedTraceIds.get(0);
} }
private String serializeDistributedTraceId() { private String getPrimaryDistributedTraceId() {
return primaryDistributedTraceId.toString(); return primaryDistributedTraceId.toString();
} }
public String getParentOperationName() {
return parentOperationName;
}
} }
...@@ -2,7 +2,6 @@ package org.skywalking.apm.agent.core.context; ...@@ -2,7 +2,6 @@ package org.skywalking.apm.agent.core.context;
import java.util.List; import java.util.List;
import org.skywalking.apm.agent.core.context.ids.DistributedTraceId; import org.skywalking.apm.agent.core.context.ids.DistributedTraceId;
import org.skywalking.apm.agent.core.dictionary.DictionaryUtil;
import org.skywalking.apm.util.StringUtil; import org.skywalking.apm.util.StringUtil;
/** /**
...@@ -24,24 +23,38 @@ public class ContextSnapshot { ...@@ -24,24 +23,38 @@ public class ContextSnapshot {
private String entryOperationName; private String entryOperationName;
private String parentOperationName;
/** /**
* {@link DistributedTraceId} * {@link DistributedTraceId}
*/ */
private DistributedTraceId primaryDistributedTraceId; private DistributedTraceId primaryDistributedTraceId;
ContextSnapshot(String traceSegmentId, int spanId, ContextSnapshot(String traceSegmentId, int spanId,
List<DistributedTraceId> distributedTraceIds, int entryServiceId, String entryOperationName) { List<DistributedTraceId> distributedTraceIds) {
this.traceSegmentId = traceSegmentId; this.traceSegmentId = traceSegmentId;
this.spanId = spanId; this.spanId = spanId;
this.primaryDistributedTraceId = distributedTraceIds.get(0); if (distributedTraceIds != null) {
this.primaryDistributedTraceId = distributedTraceIds.get(0);
if (entryServiceId == DictionaryUtil.nullValue()) {
this.entryOperationName = "#" + entryOperationName;
} else {
this.entryOperationName = String.valueOf(entryServiceId);
} }
} }
public void setEntryOperationName(String entryOperationName) {
this.entryOperationName = "#" + entryOperationName;
}
public void setEntryOperationId(int entryOperationId) {
this.entryOperationName = entryOperationId + "";
}
public void setParentOperationName(String parentOperationName) {
this.parentOperationName = "#" + parentOperationName;
}
public void setParentOperationId(int parentOperationId) {
this.parentOperationName = parentOperationId + "";
}
public DistributedTraceId getDistributedTraceId() { public DistributedTraceId getDistributedTraceId() {
return primaryDistributedTraceId; return primaryDistributedTraceId;
} }
...@@ -54,11 +67,16 @@ public class ContextSnapshot { ...@@ -54,11 +67,16 @@ public class ContextSnapshot {
return spanId; return spanId;
} }
public String getParentOperationName() {
return parentOperationName;
}
public boolean isValid() { public boolean isValid() {
return traceSegmentId != null return traceSegmentId != null
&& spanId > -1 && spanId > -1
&& primaryDistributedTraceId != null && primaryDistributedTraceId != null
&& !StringUtil.isEmpty(entryOperationName); && !StringUtil.isEmpty(entryOperationName)
&& !StringUtil.isEmpty(parentOperationName);
} }
public String getEntryOperationName() { public String getEntryOperationName() {
......
...@@ -33,7 +33,7 @@ public class IgnoredTracerContext implements AbstractTracerContext { ...@@ -33,7 +33,7 @@ public class IgnoredTracerContext implements AbstractTracerContext {
} }
@Override public ContextSnapshot capture() { @Override public ContextSnapshot capture() {
return new ContextSnapshot(null, -1, null, 0, null); return new ContextSnapshot(null, -1, null);
} }
@Override public void continued(ContextSnapshot snapshot) { @Override public void continued(ContextSnapshot snapshot) {
......
...@@ -96,8 +96,8 @@ public class TracingContext implements AbstractTracerContext { ...@@ -96,8 +96,8 @@ public class TracingContext implements AbstractTracerContext {
String operationName; String operationName;
if (refs != null && refs.size() > 0) { if (refs != null && refs.size() > 0) {
TraceSegmentRef ref = refs.get(0); TraceSegmentRef ref = refs.get(0);
operationId = ref.getOperationId(); operationId = ref.getEntryOperationId();
operationName = ref.getOperationName(); operationName = ref.getEntryOperationName();
} else { } else {
AbstractTracingSpan firstSpan = first(); AbstractTracingSpan firstSpan = first();
operationId = firstSpan.getOperationId(); operationId = firstSpan.getOperationId();
...@@ -109,6 +109,13 @@ public class TracingContext implements AbstractTracerContext { ...@@ -109,6 +109,13 @@ public class TracingContext implements AbstractTracerContext {
carrier.setEntryOperationId(operationId); carrier.setEntryOperationId(operationId);
} }
int parentOperationId = first().getOperationId();
if (parentOperationId == DictionaryUtil.nullValue()) {
carrier.setParentOperationName(first().getOperationName());
} else {
carrier.setParentOperationId(parentOperationId);
}
carrier.setDistributedTraceIds(this.segment.getRelatedGlobalTraces()); carrier.setDistributedTraceIds(this.segment.getRelatedGlobalTraces());
} }
...@@ -133,19 +140,32 @@ public class TracingContext implements AbstractTracerContext { ...@@ -133,19 +140,32 @@ public class TracingContext implements AbstractTracerContext {
@Override @Override
public ContextSnapshot capture() { public ContextSnapshot capture() {
List<TraceSegmentRef> refs = this.segment.getRefs(); List<TraceSegmentRef> refs = this.segment.getRefs();
ContextSnapshot snapshot = new ContextSnapshot(segment.getTraceSegmentId(),
activeSpan().getSpanId(),
segment.getRelatedGlobalTraces());
int entryOperationId;
String entryOperationName;
AbstractTracingSpan firstSpan = first();
if (refs != null && refs.size() > 0) { if (refs != null && refs.size() > 0) {
TraceSegmentRef ref = refs.get(0); TraceSegmentRef ref = refs.get(0);
return new ContextSnapshot(segment.getTraceSegmentId(), entryOperationId = ref.getEntryOperationId();
activeSpan().getSpanId(), entryOperationName = ref.getEntryOperationName();
segment.getRelatedGlobalTraces(), ref.getOperationId(), ref.getOperationName()
);
} else { } else {
AbstractTracingSpan firstSpan = first(); entryOperationId = firstSpan.getOperationId();
return new ContextSnapshot(segment.getTraceSegmentId(), entryOperationName = firstSpan.getOperationName();
activeSpan().getSpanId(), }
segment.getRelatedGlobalTraces(), firstSpan.getOperationId(), firstSpan.getOperationName() if (entryOperationId == DictionaryUtil.nullValue()) {
); snapshot.setEntryOperationName(entryOperationName);
} else {
snapshot.setEntryOperationId(entryOperationId);
}
if (firstSpan.getOperationId() == DictionaryUtil.nullValue()) {
snapshot.setParentOperationName(firstSpan.getOperationName());
} else {
snapshot.setParentOperationId(firstSpan.getOperationId());
} }
return snapshot;
} }
/** /**
......
...@@ -25,9 +25,13 @@ public class TraceSegmentRef { ...@@ -25,9 +25,13 @@ public class TraceSegmentRef {
private int peerId = DictionaryUtil.nullValue(); private int peerId = DictionaryUtil.nullValue();
private String operationName; private String entryOperationName;
private int operationId = DictionaryUtil.nullValue(); private int entryOperationId = DictionaryUtil.nullValue();
private String parentOperationName;
private int parentOperationId = DictionaryUtil.nullValue();
/** /**
* Transform a {@link ContextCarrier} to the <code>TraceSegmentRef</code> * Transform a {@link ContextCarrier} to the <code>TraceSegmentRef</code>
...@@ -47,9 +51,15 @@ public class TraceSegmentRef { ...@@ -47,9 +51,15 @@ public class TraceSegmentRef {
} }
String entryOperationName = carrier.getEntryOperationName(); String entryOperationName = carrier.getEntryOperationName();
if (entryOperationName.charAt(0) == '#') { if (entryOperationName.charAt(0) == '#') {
this.operationName = entryOperationName.substring(1); this.entryOperationName = entryOperationName.substring(1);
} else {
this.entryOperationId = Integer.parseInt(entryOperationName);
}
String parentOperationName = carrier.getParentOperationName();
if (parentOperationName.charAt(0) == '#') {
this.parentOperationName = parentOperationName.substring(1);
} else { } else {
this.operationId = Integer.parseInt(entryOperationName); this.parentOperationId = Integer.parseInt(parentOperationName);
} }
} }
...@@ -59,18 +69,24 @@ public class TraceSegmentRef { ...@@ -59,18 +69,24 @@ public class TraceSegmentRef {
this.spanId = snapshot.getSpanId(); this.spanId = snapshot.getSpanId();
String entryOperationName = snapshot.getEntryOperationName(); String entryOperationName = snapshot.getEntryOperationName();
if (entryOperationName.charAt(0) == '#') { if (entryOperationName.charAt(0) == '#') {
this.operationName = entryOperationName.substring(1); this.entryOperationName = entryOperationName.substring(1);
} else { } else {
this.operationId = Integer.parseInt(entryOperationName); this.entryOperationId = Integer.parseInt(entryOperationName);
}
String parentOperationName = snapshot.getParentOperationName();
if (parentOperationName.charAt(0) == '#') {
this.parentOperationName = parentOperationName.substring(1);
} else {
this.parentOperationId = Integer.parseInt(parentOperationName);
} }
} }
public String getOperationName() { public String getEntryOperationName() {
return operationName; return entryOperationName;
} }
public int getOperationId() { public int getEntryOperationId() {
return operationId; return entryOperationId;
} }
public TraceSegmentReference transform() { public TraceSegmentReference transform() {
...@@ -89,10 +105,15 @@ public class TraceSegmentRef { ...@@ -89,10 +105,15 @@ public class TraceSegmentRef {
refBuilder.setParentTraceSegmentId(traceSegmentId); refBuilder.setParentTraceSegmentId(traceSegmentId);
refBuilder.setParentSpanId(spanId); refBuilder.setParentSpanId(spanId);
if (operationId == DictionaryUtil.nullValue()) { if (entryOperationId == DictionaryUtil.nullValue()) {
refBuilder.setEntryServiceName(operationName); refBuilder.setEntryServiceName(entryOperationName);
} else {
refBuilder.setEntryServiceId(entryOperationId);
}
if (parentOperationId == DictionaryUtil.nullValue()) {
refBuilder.setParentServiceName(parentOperationName);
} else { } else {
refBuilder.setEntryServiceId(operationId); refBuilder.setParentServiceId(parentOperationId);
} }
return refBuilder.build(); return refBuilder.build();
} }
......
package org.skywalking.apm.agent.core.context; package org.skywalking.apm.agent.core.context;
import com.google.instrumentation.trace.Span;
import com.google.protobuf.InvalidProtocolBufferException; import com.google.protobuf.InvalidProtocolBufferException;
import java.util.List; import java.util.List;
import org.junit.After; import org.junit.After;
import org.junit.Before; import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.skywalking.apm.agent.core.boot.ServiceManager;
import org.skywalking.apm.agent.core.conf.RemoteDownstreamConfig; import org.skywalking.apm.agent.core.conf.RemoteDownstreamConfig;
import org.skywalking.apm.agent.core.context.tag.Tags; import org.skywalking.apm.agent.core.context.tag.Tags;
import org.skywalking.apm.agent.core.context.trace.AbstractSpan; import org.skywalking.apm.agent.core.context.trace.AbstractSpan;
...@@ -82,7 +79,7 @@ public class ContextManagerTest { ...@@ -82,7 +79,7 @@ public class ContextManagerTest {
@Test @Test
public void createMultipleEntrySpan() { public void createMultipleEntrySpan() {
ContextCarrier contextCarrier = new ContextCarrier().deserialize("S.1499176688384.581928182.80935.69.1|3|1|#192.168.1.8 :18002|#/portal/|T.1499176688386.581928182.80935.69.2"); ContextCarrier contextCarrier = new ContextCarrier().deserialize("S.1499176688384.581928182.80935.69.1|3|1|#192.168.1.8 :18002|#/portal/|#/portal/|T.1499176688386.581928182.80935.69.2");
assertTrue(contextCarrier.isValid()); assertTrue(contextCarrier.isValid());
AbstractSpan firstEntrySpan = ContextManager.createEntrySpan("/testFirstEntry", contextCarrier); AbstractSpan firstEntrySpan = ContextManager.createEntrySpan("/testFirstEntry", contextCarrier);
...@@ -115,8 +112,8 @@ public class ContextManagerTest { ...@@ -115,8 +112,8 @@ public class ContextManagerTest {
TraceSegmentRef ref = actualSegment.getRefs().get(0); TraceSegmentRef ref = actualSegment.getRefs().get(0);
assertThat(TraceSegmentRefHelper.getPeerHost(ref), is("192.168.1.8 :18002")); assertThat(TraceSegmentRefHelper.getPeerHost(ref), is("192.168.1.8 :18002"));
assertThat(ref.getOperationName(), is("/portal/")); assertThat(ref.getEntryOperationName(), is("/portal/"));
assertThat(ref.getOperationId(), is(0)); assertThat(ref.getEntryOperationId(), is(0));
List<AbstractTracingSpan> spanList = SegmentHelper.getSpan(actualSegment); List<AbstractTracingSpan> spanList = SegmentHelper.getSpan(actualSegment);
assertThat(spanList.size(), is(2)); assertThat(spanList.size(), is(2));
...@@ -205,7 +202,7 @@ public class ContextManagerTest { ...@@ -205,7 +202,7 @@ public class ContextManagerTest {
@Test @Test
public void testTransform() throws InvalidProtocolBufferException { public void testTransform() throws InvalidProtocolBufferException {
ContextCarrier contextCarrier = new ContextCarrier().deserialize("S.1499176688384.581928182.80935.69.1|3|1|#192.168.1.8 :18002|#/portal/|T.1499176688386.581928182.80935.69.2"); ContextCarrier contextCarrier = new ContextCarrier().deserialize("S.1499176688384.581928182.80935.69.1|3|1|#192.168.1.8 :18002|#/portal/|#/portal/|T.1499176688386.581928182.80935.69.2");
assertTrue(contextCarrier.isValid()); assertTrue(contextCarrier.isValid());
AbstractSpan firstEntrySpan = ContextManager.createEntrySpan("/testFirstEntry", contextCarrier); AbstractSpan firstEntrySpan = ContextManager.createEntrySpan("/testFirstEntry", contextCarrier);
......
...@@ -148,7 +148,7 @@ public class DubboInterceptorTest { ...@@ -148,7 +148,7 @@ public class DubboInterceptorTest {
@Test @Test
public void testProviderWithAttachment() throws Throwable { public void testProviderWithAttachment() throws Throwable {
when(rpcContext.isConsumerSide()).thenReturn(false); when(rpcContext.isConsumerSide()).thenReturn(false);
when(rpcContext.getAttachment(Config.Plugin.Propagation.HEADER_NAME)).thenReturn("S.1499176688384.581928182.80935.69.1|3|1|#192.168.1.8 :18002|#/portal/|T.1499176688386.581928182.80935.69.2"); when(rpcContext.getAttachment(Config.Plugin.Propagation.HEADER_NAME)).thenReturn("S.1499176688384.581928182.80935.69.1|3|1|#192.168.1.8 :18002|#/portal/|#/portal/|T.1499176688386.581928182.80935.69.2");
dubboInterceptor.beforeMethod(enhancedInstance, "invoke", allArguments, argumentTypes, methodInterceptResult); dubboInterceptor.beforeMethod(enhancedInstance, "invoke", allArguments, argumentTypes, methodInterceptResult);
dubboInterceptor.afterMethod(enhancedInstance, "invoke", allArguments, argumentTypes, result); dubboInterceptor.afterMethod(enhancedInstance, "invoke", allArguments, argumentTypes, result);
...@@ -160,7 +160,7 @@ public class DubboInterceptorTest { ...@@ -160,7 +160,7 @@ public class DubboInterceptorTest {
when(rpcContext.isConsumerSide()).thenReturn(false); when(rpcContext.isConsumerSide()).thenReturn(false);
FieldSetter.setStaticValue(BugFixActive.class, "ACTIVE", true); FieldSetter.setStaticValue(BugFixActive.class, "ACTIVE", true);
testParam.setTraceContext("S.1499176688384.581928182.80935.69.1|3|1|#192.168.1.8 :18002|#/portal/|T.1499176688386.581928182.80935.69.2"); testParam.setTraceContext("S.1499176688384.581928182.80935.69.1|3|1|#192.168.1.8 :18002|#/portal/|#/portal/|T.1499176688386.581928182.80935.69.2");
dubboInterceptor.beforeMethod(enhancedInstance, "invoke", allArguments, argumentTypes, methodInterceptResult); dubboInterceptor.beforeMethod(enhancedInstance, "invoke", allArguments, argumentTypes, methodInterceptResult);
dubboInterceptor.afterMethod(enhancedInstance, "invoke", allArguments, argumentTypes, result); dubboInterceptor.afterMethod(enhancedInstance, "invoke", allArguments, argumentTypes, result);
......
...@@ -91,7 +91,7 @@ public class MotanProviderInterceptorTest { ...@@ -91,7 +91,7 @@ public class MotanProviderInterceptorTest {
@Test @Test
public void testInvokerWithRefSegment() throws Throwable { public void testInvokerWithRefSegment() throws Throwable {
HashMap attachments = new HashMap(); HashMap attachments = new HashMap();
attachments.put(Config.Plugin.Propagation.HEADER_NAME, "S.1499176688384.581928182.80935.69.1|3|1|#192.168.1.8:18002|#/portal/|T.1499176688386.581928182.80935.69.2"); attachments.put(Config.Plugin.Propagation.HEADER_NAME, "S.1499176688384.581928182.80935.69.1|3|1|#192.168.1.8:18002|#/portal/|#/portal/|T.1499176688386.581928182.80935.69.2");
when(request.getAttachments()).thenReturn(attachments); when(request.getAttachments()).thenReturn(attachments);
invokeInterceptor.beforeMethod(enhancedInstance, "execute", arguments, argumentType, null); invokeInterceptor.beforeMethod(enhancedInstance, "execute", arguments, argumentType, null);
......
...@@ -90,7 +90,7 @@ public class ResinV3InterceptorTest { ...@@ -90,7 +90,7 @@ public class ResinV3InterceptorTest {
@Test @Test
public void testWithSerializedContextData() throws Throwable { public void testWithSerializedContextData() throws Throwable {
when(request.getHeader(Config.Plugin.Propagation.HEADER_NAME)).thenReturn("S.1499176688384.581928182.80935.69.1|3|1|#192.168.1.8:18002|#/portal/|T.1499176688386.581928182.80935.69.2"); when(request.getHeader(Config.Plugin.Propagation.HEADER_NAME)).thenReturn("S.1499176688384.581928182.80935.69.1|3|1|#192.168.1.8:18002|#/portal/|#/portal/|T.1499176688386.581928182.80935.69.2");
interceptor.beforeMethod(enhancedInstance, "service", arguments, argumentType, methodInterceptResult); interceptor.beforeMethod(enhancedInstance, "service", arguments, argumentType, methodInterceptResult);
interceptor.afterMethod(enhancedInstance, "service", arguments, argumentType, null); interceptor.afterMethod(enhancedInstance, "service", arguments, argumentType, null);
......
...@@ -92,7 +92,7 @@ public class ResinV4InterceptorTest { ...@@ -92,7 +92,7 @@ public class ResinV4InterceptorTest {
@Test @Test
public void testWithSerializedContextData() throws Throwable { public void testWithSerializedContextData() throws Throwable {
when(request.getHeader(Config.Plugin.Propagation.HEADER_NAME)).thenReturn("S.1499176688384.581928182.80935.69.1|3|1|#192.168.1.8:18002|#/portal/|T.1499176688386.581928182.80935.69.2"); when(request.getHeader(Config.Plugin.Propagation.HEADER_NAME)).thenReturn("S.1499176688384.581928182.80935.69.1|3|1|#192.168.1.8:18002|#/portal/|#/portal/|T.1499176688386.581928182.80935.69.2");
interceptor.beforeMethod(enhancedInstance, "service", arguments, argumentType, methodInterceptResult); interceptor.beforeMethod(enhancedInstance, "service", arguments, argumentType, methodInterceptResult);
interceptor.afterMethod(enhancedInstance, "service", arguments, argumentType, null); interceptor.afterMethod(enhancedInstance, "service", arguments, argumentType, null);
......
...@@ -82,7 +82,7 @@ public class TomcatInterceptorTest { ...@@ -82,7 +82,7 @@ public class TomcatInterceptorTest {
@Test @Test
public void testWithSerializedContextData() throws Throwable { public void testWithSerializedContextData() throws Throwable {
when(request.getHeader(Config.Plugin.Propagation.HEADER_NAME)).thenReturn("S.1499176688384.581928182.80935.69.1|3|1|#192.168.1.8:18002|#/portal/|T.1499176688386.581928182.80935.69.2"); when(request.getHeader(Config.Plugin.Propagation.HEADER_NAME)).thenReturn("S.1499176688384.581928182.80935.69.1|3|1|#192.168.1.8:18002|#/portal/|#/portal/|T.1499176688386.581928182.80935.69.2");
tomcatInterceptor.beforeMethod(enhancedInstance, "invoke", arguments, argumentType, methodInterceptResult); tomcatInterceptor.beforeMethod(enhancedInstance, "invoke", arguments, argumentType, methodInterceptResult);
tomcatInterceptor.afterMethod(enhancedInstance, "invoke", arguments, argumentType, null); tomcatInterceptor.afterMethod(enhancedInstance, "invoke", arguments, argumentType, null);
......
...@@ -181,7 +181,7 @@ public class SkywalkingSpanActivationTest { ...@@ -181,7 +181,7 @@ public class SkywalkingSpanActivationTest {
.withTag(Tags.PEER_HOST_IPV4.getKey(), "127.0.0.1").withTag(Tags.PEER_PORT.getKey(), 8080); .withTag(Tags.PEER_HOST_IPV4.getKey(), "127.0.0.1").withTag(Tags.PEER_PORT.getKey(), 8080);
startSpan(); startSpan();
extractInterceptor.afterMethod(enhancedInstance, "extract", extractInterceptor.afterMethod(enhancedInstance, "extract",
new Object[] {"S.1499746282749.1100157028.88023.1.1|0|1|#127.0.0.1:8080|#testOperationName|T.1499746282768.1100157028.88023.1.2"}, new Class[] {String.class}, null); new Object[] {"S.1499746282749.1100157028.88023.1.1|0|1|#127.0.0.1:8080|#testOperationName|#testOperationName|T.1499746282768.1100157028.88023.1.2"}, new Class[] {String.class}, null);
stopSpan(); stopSpan();
TraceSegment tracingSegment = assertTraceSemgnets(); TraceSegment tracingSegment = assertTraceSemgnets();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册