Skip to content

Commit 835133e

Browse files
committed
change parent-child propagatoin
1 parent af906ae commit 835133e

File tree

2 files changed

+16
-7
lines changed

2 files changed

+16
-7
lines changed

dd-java-agent/instrumentation/mule-4/src/main/java/datadog/trace/instrumentation/mule4/EventContextCreationAdvice.java

+6-5
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,14 @@ public static void onExit(
3838
} else if (arg instanceof EventContext) {
3939
// This means that we are in the constructor for ChildContext and we should copy the span
4040
// from the parent EventContext which is the first argument.
41-
spanState = contextStore.get((EventContext) arg);
42-
if (spanState != null) {
43-
spanState = spanState.copy();
44-
} else {
45-
spanState = new SpanState(activeSpan(), null);
41+
final SpanState parentState = contextStore.get((EventContext) arg);
42+
if (parentState != null) {
43+
spanState = new SpanState(parentState.getEventContextSpan(), null);
4644
}
45+
// TODO: remove me
46+
System.err.println("CHILD CREATED " + " " + activeSpan() + " " + spanState);
4747
}
48+
4849
contextStore.put(zis, spanState);
4950
}
5051

dd-java-agent/instrumentation/mule-4/src/main/java/datadog/trace/instrumentation/mule4/SpanState.java

+10-2
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,15 @@ public SpanState withSpanContextSpan(AgentSpan spanContextSpan) {
2929
return this;
3030
}
3131

32-
public SpanState copy() {
33-
return new SpanState(eventContextSpan, previousState).withSpanContextSpan(spanContextSpan);
32+
@Override
33+
public String toString() {
34+
return "SpanState{"
35+
+ "eventContextSpan="
36+
+ eventContextSpan
37+
+ ", previousState="
38+
+ previousState
39+
+ ", spanContextSpan="
40+
+ spanContextSpan
41+
+ '}';
3442
}
3543
}

0 commit comments

Comments
 (0)