Skip to content

Commit 46d5b5c

Browse files
committed
Remove AgentTracer.capture
1 parent 429031c commit 46d5b5c

File tree

6 files changed

+12
-14
lines changed

6 files changed

+12
-14
lines changed

dd-java-agent/instrumentation/play-ws-1/src/main/java/datadog/trace/instrumentation/playws1/AsyncHandlerWrapper.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package datadog.trace.instrumentation.playws1;
22

3-
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.capture;
3+
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.captureSpan;
44
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.setAsyncPropagationEnabled;
55
import static datadog.trace.instrumentation.playws.PlayWSClientDecorator.DECORATE;
66

@@ -22,7 +22,7 @@ public class AsyncHandlerWrapper implements AsyncHandler {
2222
public AsyncHandlerWrapper(final AsyncHandler delegate, final AgentSpan span) {
2323
this.delegate = delegate;
2424
this.span = span;
25-
continuation = capture();
25+
continuation = captureSpan(span);
2626
}
2727

2828
@Override

dd-java-agent/instrumentation/play-ws-2.1/src/main/java/datadog/trace/instrumentation/playws21/AsyncHandlerWrapper.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package datadog.trace.instrumentation.playws21;
22

3-
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.capture;
3+
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.captureSpan;
44
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.setAsyncPropagationEnabled;
55
import static datadog.trace.instrumentation.playws.PlayWSClientDecorator.DECORATE;
66

@@ -27,7 +27,7 @@ public class AsyncHandlerWrapper implements AsyncHandler {
2727
public AsyncHandlerWrapper(final AsyncHandler delegate, final AgentSpan span) {
2828
this.delegate = delegate;
2929
this.span = span;
30-
continuation = capture();
30+
continuation = captureSpan(span);
3131
}
3232

3333
@Override

dd-java-agent/instrumentation/play-ws-2/src/main/java/datadog/trace/instrumentation/playws2/AsyncHandlerWrapper.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package datadog.trace.instrumentation.playws2;
22

3-
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.capture;
3+
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.captureSpan;
44
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.setAsyncPropagationEnabled;
55
import static datadog.trace.instrumentation.playws.PlayWSClientDecorator.DECORATE;
66

@@ -26,7 +26,7 @@ public class AsyncHandlerWrapper implements AsyncHandler {
2626
public AsyncHandlerWrapper(final AsyncHandler delegate, final AgentSpan span) {
2727
this.delegate = delegate;
2828
this.span = span;
29-
continuation = capture();
29+
continuation = captureSpan(span);
3030
}
3131

3232
@Override

dd-java-agent/instrumentation/servicetalk/src/test/groovy/ContextPreservingInstrumentationTest.groovy

+1-1
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ class ContextPreservingInstrumentationTest extends AgentTestRunner {
113113
*/
114114
private class ParentContext {
115115
final ContextMap contextMap = AsyncContext.context().copy()
116-
final AgentScope.Continuation spanContinuation = AgentTracer.capture()
116+
final AgentScope.Continuation spanContinuation = AgentTracer.captureSpan(AgentTracer.activeSpan())
117117

118118
def releaseParentSpan() {
119119
spanContinuation.cancel()

dd-java-agent/instrumentation/zio/zio-2.0/src/main/java/datadog/trace/instrumentation/zio/v2_0/FiberContext.java

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
package datadog.trace.instrumentation.zio.v2_0;
22

3-
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.capture;
3+
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.activeSpan;
4+
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.captureSpan;
45

56
import datadog.trace.bootstrap.instrumentation.api.AgentScope;
7+
import datadog.trace.bootstrap.instrumentation.api.AgentSpan;
68
import datadog.trace.bootstrap.instrumentation.api.AgentTracer;
79
import datadog.trace.bootstrap.instrumentation.api.ScopeState;
810

@@ -16,7 +18,8 @@ private FiberContext(ScopeState state) {
1618
this.state = state;
1719
this.scope = null;
1820
this.oldState = null;
19-
this.continuation = capture();
21+
AgentSpan span = activeSpan();
22+
this.continuation = null != span ? captureSpan(span) : null;
2023
}
2124

2225
public static FiberContext create() {

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

-5
Original file line numberDiff line numberDiff line change
@@ -131,11 +131,6 @@ public static AgentScope activeScope() {
131131
return get().activeScope();
132132
}
133133

134-
public static AgentScope.Continuation capture() {
135-
final AgentScope activeScope = activeScope();
136-
return activeScope == null ? null : activeScope.capture();
137-
}
138-
139134
/**
140135
* Checks whether asynchronous propagation is enabled, meaning this context will propagate across
141136
* asynchronous boundaries.

0 commit comments

Comments
 (0)