Skip to content

Commit 8799a82

Browse files
authored
Provide access to the captured Context from its Continuation (#9427)
1 parent 646403a commit 8799a82

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

dd-trace-core/src/main/java/datadog/trace/core/scopemanager/ScopeContinuation.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,11 @@ public AgentSpan span() {
122122
return AgentSpan.fromContext(context);
123123
}
124124

125+
@Override
126+
public Context context() {
127+
return context;
128+
}
129+
125130
@Override
126131
public String toString() {
127132
return getClass().getSimpleName() + "@" + Integer.toHexString(hashCode()) + "->" + context;

internal-api/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ val excludedClassesCoverage by extra(
8484
"datadog.trace.bootstrap.instrumentation.api.AgentPropagation",
8585
"datadog.trace.bootstrap.instrumentation.api.AgentPropagation.ContextVisitor",
8686
"datadog.trace.bootstrap.instrumentation.api.AgentScope",
87+
"datadog.trace.bootstrap.instrumentation.api.AgentScope.Continuation",
8788
"datadog.trace.bootstrap.instrumentation.api.AgentSpan",
8889
"datadog.trace.bootstrap.instrumentation.api.AgentSpanContext",
8990
"datadog.trace.bootstrap.instrumentation.api.AgentTracer",

internal-api/src/main/java/datadog/trace/bootstrap/instrumentation/api/AgentScope.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,10 @@ interface Continuation extends TraceScope.Continuation {
2525

2626
/** Provide access to the captured span */
2727
AgentSpan span();
28+
29+
/** Provide access to the captured context */
30+
default Context context() {
31+
return span();
32+
}
2833
}
2934
}

0 commit comments

Comments
 (0)