Skip to content

Commit 4905729

Browse files
authoredJan 8, 2025··
Remove custom scope manager support (#8164)
* chore(ot): Remove custom scope manager support * chore(core): Remove custom scope manager support
1 parent 54d4a6f commit 4905729

File tree

11 files changed

+58
-901
lines changed

11 files changed

+58
-901
lines changed
 

‎dd-trace-core/src/main/java/datadog/trace/core/CoreTracer.java

+10-23
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@
5151
import datadog.trace.bootstrap.instrumentation.api.AgentHistogram;
5252
import datadog.trace.bootstrap.instrumentation.api.AgentPropagation;
5353
import datadog.trace.bootstrap.instrumentation.api.AgentScope;
54-
import datadog.trace.bootstrap.instrumentation.api.AgentScopeManager;
5554
import datadog.trace.bootstrap.instrumentation.api.AgentSpan;
5655
import datadog.trace.bootstrap.instrumentation.api.AgentSpanLink;
5756
import datadog.trace.bootstrap.instrumentation.api.AgentTracer;
@@ -165,7 +164,7 @@ public static CoreTracerBuilder builder() {
165164
/** Sampler defines the sampling policy in order to reduce the number of traces for instance */
166165
final Sampler initialSampler;
167166
/** Scope manager is in charge of managing the scopes from which spans are created */
168-
final AgentScopeManager scopeManager;
167+
final ContinuableScopeManager scopeManager;
169168

170169
final MetricsAggregator metricsAggregator;
171170

@@ -295,7 +294,7 @@ public static class CoreTracerBuilder {
295294
private SingleSpanSampler singleSpanSampler;
296295
private HttpCodec.Injector injector;
297296
private HttpCodec.Extractor extractor;
298-
private AgentScopeManager scopeManager;
297+
private ContinuableScopeManager scopeManager;
299298
private Map<String, ?> localRootSpanTags;
300299
private Map<String, ?> defaultSpanTags;
301300
private Map<String, String> serviceNameMappings;
@@ -356,11 +355,6 @@ public CoreTracerBuilder extractor(HttpCodec.Extractor extractor) {
356355
return this;
357356
}
358357

359-
public CoreTracerBuilder scopeManager(AgentScopeManager scopeManager) {
360-
this.scopeManager = scopeManager;
361-
return this;
362-
}
363-
364358
public CoreTracerBuilder localRootSpanTags(Map<String, ?> localRootSpanTags) {
365359
this.localRootSpanTags = tryMakeImmutableMap(localRootSpanTags);
366360
return this;
@@ -497,7 +491,6 @@ public CoreTracer build() {
497491
singleSpanSampler,
498492
injector,
499493
extractor,
500-
scopeManager,
501494
localRootSpanTags,
502495
defaultSpanTags,
503496
serviceNameMappings,
@@ -529,7 +522,6 @@ private CoreTracer(
529522
final SingleSpanSampler singleSpanSampler,
530523
final HttpCodec.Injector injector,
531524
final HttpCodec.Extractor extractor,
532-
final AgentScopeManager scopeManager,
533525
final Map<String, ?> localRootSpanTags,
534526
final Map<String, ?> defaultSpanTags,
535527
final Map<String, String> serviceNameMappings,
@@ -632,16 +624,13 @@ private CoreTracer(
632624
: Monitoring.DISABLED;
633625

634626
traceWriteTimer = performanceMonitoring.newThreadLocalTimer("trace.write");
635-
if (scopeManager == null) {
636-
this.scopeManager =
637-
new ContinuableScopeManager(
638-
config.getScopeDepthLimit(),
639-
config.isScopeStrictMode(),
640-
profilingContextIntegration,
641-
healthMetrics);
642-
} else {
643-
this.scopeManager = scopeManager;
644-
}
627+
628+
scopeManager =
629+
new ContinuableScopeManager(
630+
config.getScopeDepthLimit(),
631+
config.isScopeStrictMode(),
632+
profilingContextIntegration,
633+
healthMetrics);
645634

646635
externalAgentLauncher = new ExternalAgentLauncher(config);
647636

@@ -1108,9 +1097,7 @@ public DataStreamsCheckpointer getDataStreamsCheckpointer() {
11081097

11091098
@Override
11101099
public void addScopeListener(final ScopeListener listener) {
1111-
if (scopeManager instanceof ContinuableScopeManager) {
1112-
((ContinuableScopeManager) scopeManager).addScopeListener(listener);
1113-
}
1100+
this.scopeManager.addScopeListener(listener);
11141101
}
11151102

11161103
@Override

‎dd-trace-core/src/main/java/datadog/trace/core/scopemanager/ContinuableScopeManager.java

+2-9
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@
1111
import datadog.trace.api.scopemanager.ExtendedScopeListener;
1212
import datadog.trace.api.scopemanager.ScopeListener;
1313
import datadog.trace.bootstrap.instrumentation.api.AgentScope;
14-
import datadog.trace.bootstrap.instrumentation.api.AgentScopeManager;
1514
import datadog.trace.bootstrap.instrumentation.api.AgentSpan;
1615
import datadog.trace.bootstrap.instrumentation.api.AgentTracer;
1716
import datadog.trace.bootstrap.instrumentation.api.ProfilerContext;
1817
import datadog.trace.bootstrap.instrumentation.api.ProfilingContextIntegration;
1918
import datadog.trace.bootstrap.instrumentation.api.ScopeSource;
2019
import datadog.trace.bootstrap.instrumentation.api.ScopeState;
20+
import datadog.trace.bootstrap.instrumentation.api.ScopeStateAware;
2121
import datadog.trace.core.monitor.HealthMetrics;
2222
import datadog.trace.relocate.api.RatelimitedLogger;
2323
import datadog.trace.util.AgentTaskScheduler;
@@ -37,7 +37,7 @@
3737
* from being reported even if all related spans are finished. It also delegates to other
3838
* ScopeInterceptors to provide additional functionality.
3939
*/
40-
public final class ContinuableScopeManager implements AgentScopeManager {
40+
public final class ContinuableScopeManager implements ScopeStateAware {
4141
static final Logger log = LoggerFactory.getLogger(ContinuableScopeManager.class);
4242
static final RatelimitedLogger ratelimitedLog = new RatelimitedLogger(log, 1, MINUTES);
4343
static final long iterationKeepAlive =
@@ -81,18 +81,15 @@ public ContinuableScopeManager(
8181
this.profilingContextIntegration = profilingContextIntegration;
8282
}
8383

84-
@Override
8584
public AgentScope activate(final AgentSpan span, final ScopeSource source) {
8685
return activate(span, source.id(), false, /* ignored */ false);
8786
}
8887

89-
@Override
9088
public AgentScope activate(
9189
final AgentSpan span, final ScopeSource source, boolean isAsyncPropagating) {
9290
return activate(span, source.id(), true, isAsyncPropagating);
9391
}
9492

95-
@Override
9693
public AgentScope.Continuation captureSpan(final AgentSpan span) {
9794
AbstractContinuation continuation =
9895
new SingleContinuation(this, span, ScopeSource.INSTRUMENTATION.id());
@@ -170,7 +167,6 @@ ContinuableScope continueSpan(
170167
return scope;
171168
}
172169

173-
@Override
174170
public void closePrevious(final boolean finishSpan) {
175171
ScopeStack scopeStack = scopeStack();
176172

@@ -189,7 +185,6 @@ public void closePrevious(final boolean finishSpan) {
189185
}
190186
}
191187

192-
@Override
193188
public AgentScope activateNext(final AgentSpan span) {
194189
ScopeStack scopeStack = scopeStack();
195190

@@ -220,12 +215,10 @@ public AgentScope activateNext(final AgentSpan span) {
220215
return scope;
221216
}
222217

223-
@Override
224218
public AgentScope active() {
225219
return scopeStack().active();
226220
}
227221

228-
@Override
229222
public AgentSpan activeSpan() {
230223
final ContinuableScope active = scopeStack().active();
231224
return active == null ? null : active.span;

‎dd-trace-ot/src/main/java/datadog/opentracing/CustomScopeManagerWrapper.java

-268
This file was deleted.

‎dd-trace-ot/src/main/java/datadog/opentracing/DDTracer.java

+2-14
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ public static class DDTracerBuilder {
8484
private Sampler sampler;
8585
private HttpCodec.Injector injector;
8686
private HttpCodec.Extractor extractor;
87-
private ScopeManager scopeManager;
8887
private Map<String, String> localRootSpanTags;
8988
private Map<String, String> defaultSpanTags;
9089
private Map<String, String> serviceNameMappings;
@@ -125,9 +124,7 @@ public DDTracerBuilder extractor(HttpCodec.Extractor extractor) {
125124

126125
@Deprecated
127126
public DDTracerBuilder scopeManager(ScopeManager scopeManager) {
128-
log.warn(
129-
"Custom ScopeManagers are deprecated and will be removed in a future release of dd-trace-ot");
130-
this.scopeManager = scopeManager;
127+
log.warn("Custom ScopeManagers are not supported");
131128
return this;
132129
}
133130

@@ -178,7 +175,6 @@ public DDTracer build() {
178175
sampler,
179176
injector,
180177
extractor,
181-
scopeManager,
182178
localRootSpanTags,
183179
defaultSpanTags,
184180
serviceNameMappings,
@@ -323,7 +319,6 @@ private DDTracer(
323319
final Sampler sampler,
324320
final HttpCodec.Injector injector,
325321
final HttpCodec.Extractor extractor,
326-
final ScopeManager scopeManager,
327322
final Map<String, String> localRootSpanTags,
328323
final Map<String, String> defaultSpanTags,
329324
final Map<String, String> serviceNameMappings,
@@ -376,11 +371,6 @@ private DDTracer(
376371
builder = builder.extractor(extractor);
377372
}
378373

379-
if (scopeManager != null) {
380-
this.scopeManager = scopeManager;
381-
builder = builder.scopeManager(new CustomScopeManagerWrapper(scopeManager, converter));
382-
}
383-
384374
if (localRootSpanTags != null) {
385375
builder = builder.localRootSpanTags(localRootSpanTags);
386376
}
@@ -410,9 +400,7 @@ private DDTracer(
410400
// FIXME [API] There's an unfortunate cycle between OTScopeManager and CoreTracer where they
411401
// depend on each other so CoreTracer
412402
// Perhaps api can change so that CoreTracer doesn't need to implement scope methods directly
413-
if (scopeManager == null) {
414-
this.scopeManager = new OTScopeManager(tracer, converter);
415-
}
403+
this.scopeManager = new OTScopeManager(tracer, converter);
416404

417405
if ((config != null && config.isLogsInjectionEnabled())
418406
|| (config == null && Config.get().isLogsInjectionEnabled())) {

‎dd-trace-ot/src/main/java/datadog/opentracing/TypeConverter.java

-150
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import datadog.trace.bootstrap.instrumentation.api.AgentSpan;
55
import datadog.trace.bootstrap.instrumentation.api.AgentTracer;
66
import datadog.trace.bootstrap.instrumentation.api.AttachableWrapper;
7-
import datadog.trace.bootstrap.instrumentation.api.ScopeSource;
87
import io.opentracing.Scope;
98
import io.opentracing.Span;
109
import io.opentracing.SpanContext;
@@ -54,23 +53,6 @@ public OTSpan toSpan(final AgentSpan agentSpan) {
5453
return new OTSpan(agentSpan, this, logHandler);
5554
}
5655

57-
public AgentScope toAgentScope(final Span span, final Scope scope) {
58-
// check both: with OT33 we could have an active span with a null scope
59-
// because the method to retrieve the active scope was removed in OT33
60-
if (span == null && scope == null) {
61-
return null;
62-
} else if (scope instanceof OTScopeManager.OTScope) {
63-
OTScopeManager.OTScope wrapper = (OTScopeManager.OTScope) scope;
64-
if (wrapper.isFinishSpanOnClose()) {
65-
return new FinishingScope(wrapper.unwrap());
66-
} else {
67-
return wrapper.unwrap();
68-
}
69-
} else {
70-
return new CustomScope(span, scope);
71-
}
72-
}
73-
7456
public Scope toScope(final AgentScope scope, final boolean finishSpanOnClose) {
7557
if (scope == null) {
7658
return null;
@@ -114,136 +96,4 @@ public AgentSpan.Context toContext(final SpanContext spanContext) {
11496
return AgentTracer.NoopContext.INSTANCE;
11597
}
11698
}
117-
118-
/**
119-
* Wraps an internal {@link AgentScope} to automatically finish its span when the scope is closed.
120-
*/
121-
static final class FinishingScope implements AgentScope {
122-
private final AgentScope delegate;
123-
124-
private FinishingScope(final AgentScope delegate) {
125-
this.delegate = delegate;
126-
}
127-
128-
@Override
129-
public AgentSpan span() {
130-
return delegate.span();
131-
}
132-
133-
@Override
134-
public byte source() {
135-
return delegate.source();
136-
}
137-
138-
@Override
139-
public void close() {
140-
delegate.close();
141-
delegate.span().finish();
142-
}
143-
144-
@Override
145-
public Continuation capture() {
146-
return delegate.capture();
147-
}
148-
149-
@Override
150-
public Continuation captureConcurrent() {
151-
return delegate.captureConcurrent();
152-
}
153-
154-
@Override
155-
public boolean isAsyncPropagating() {
156-
return delegate.isAsyncPropagating();
157-
}
158-
159-
@Override
160-
public void setAsyncPropagation(final boolean value) {
161-
delegate.setAsyncPropagation(value);
162-
}
163-
164-
@Override
165-
public boolean equals(Object o) {
166-
if (this == o) {
167-
return true;
168-
}
169-
if (o instanceof FinishingScope) {
170-
return delegate.equals(((FinishingScope) o).delegate);
171-
}
172-
return false;
173-
}
174-
175-
@Override
176-
public int hashCode() {
177-
return delegate.hashCode();
178-
}
179-
}
180-
181-
/** Wraps an external {@link Scope} to look like an internal {@link AgentScope} */
182-
final class CustomScope implements AgentScope {
183-
private final Span span;
184-
private final Scope scope; // may be null on OT33 as we can't retrieve the active scope
185-
186-
private CustomScope(final Span span, final Scope scope) {
187-
this.span = span;
188-
this.scope = scope;
189-
}
190-
191-
@Override
192-
public void close() {
193-
if (scope != null) {
194-
scope.close();
195-
}
196-
}
197-
198-
@Override
199-
public AgentSpan span() {
200-
return toAgentSpan(span);
201-
}
202-
203-
@Override
204-
public byte source() {
205-
return ScopeSource.MANUAL.id();
206-
}
207-
208-
@Override
209-
public Continuation capture() {
210-
return null;
211-
}
212-
213-
@Override
214-
public Continuation captureConcurrent() {
215-
return null;
216-
}
217-
218-
@Override
219-
public boolean isAsyncPropagating() {
220-
return false;
221-
}
222-
223-
@Override
224-
public void setAsyncPropagation(final boolean value) {
225-
// discard setting
226-
}
227-
228-
@Override
229-
public boolean equals(Object o) {
230-
if (this == o) {
231-
return true;
232-
}
233-
if (o instanceof CustomScope) {
234-
CustomScope customScope = (CustomScope) o;
235-
if (scope != null && customScope.scope != null) {
236-
return scope.equals(customScope.scope);
237-
} else {
238-
return span.equals(customScope.span);
239-
}
240-
}
241-
return false;
242-
}
243-
244-
@Override
245-
public int hashCode() {
246-
return scope != null ? scope.hashCode() : span.hashCode();
247-
}
248-
}
24999
}

‎dd-trace-ot/src/ot31CompatibilityTest/groovy/OT31ApiTest.groovy

+8-24
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@ import datadog.opentracing.DDTracer
22
import datadog.trace.api.DDSpanId
33
import datadog.trace.api.DDTraceId
44
import datadog.trace.api.internal.util.LongStringUtils
5-
import io.opentracing.util.ThreadLocalScopeManager
6-
7-
import static datadog.trace.api.sampling.PrioritySampling.*
8-
import static datadog.trace.api.sampling.SamplingMechanism.*
95
import datadog.trace.common.writer.ListWriter
106
import datadog.trace.core.DDSpan
117
import datadog.trace.test.util.DDSpecification
@@ -16,6 +12,14 @@ import spock.lang.Subject
1612

1713
import static datadog.trace.agent.test.asserts.ListWriterAssert.assertTraces
1814
import static datadog.trace.agent.test.utils.TraceUtils.basicSpan
15+
import static datadog.trace.api.sampling.PrioritySampling.SAMPLER_DROP
16+
import static datadog.trace.api.sampling.PrioritySampling.SAMPLER_KEEP
17+
import static datadog.trace.api.sampling.PrioritySampling.UNSET
18+
import static datadog.trace.api.sampling.PrioritySampling.USER_DROP
19+
import static datadog.trace.api.sampling.PrioritySampling.USER_KEEP
20+
import static datadog.trace.api.sampling.SamplingMechanism.AGENT_RATE
21+
import static datadog.trace.api.sampling.SamplingMechanism.DEFAULT
22+
import static datadog.trace.api.sampling.SamplingMechanism.MANUAL
1923

2024
// This test focuses on things that are different between OpenTracing API 0.31.0 and 0.32.0
2125
class OT31ApiTest extends DDSpecification {
@@ -77,26 +81,6 @@ class OT31ApiTest extends DDSpecification {
7781
finishSpan << [true, false]
7882
}
7983

80-
def "test custom scopemanager"() {
81-
setup:
82-
def customTracer = DDTracer.builder().writer(writer).scopeManager(new ThreadLocalScopeManager()).build()
83-
def coreTracer = customTracer.tracer
84-
85-
when:
86-
def span = customTracer.buildSpan("some name").start()
87-
def scope = customTracer.scopeManager().activate(span, false)
88-
89-
then:
90-
customTracer.scopeManager().active().span().delegate == span.delegate
91-
coreTracer.activeScope().span() == span.delegate
92-
coreTracer.activeSpan() == span.delegate
93-
94-
cleanup:
95-
scope.close()
96-
span.finish()
97-
customTracer.close()
98-
}
99-
10084
def "test inject extract"() {
10185
setup:
10286
def span = tracer.buildSpan("some name").start()

‎dd-trace-ot/src/ot33CompatibilityTest/groovy/OT33ApiTest.groovy

+8-23
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,18 @@ import datadog.trace.test.util.DDSpecification
88
import io.opentracing.Tracer
99
import io.opentracing.propagation.Format
1010
import io.opentracing.propagation.TextMap
11-
import io.opentracing.util.ThreadLocalScopeManager
1211
import spock.lang.Subject
1312

1413
import static datadog.trace.agent.test.asserts.ListWriterAssert.assertTraces
1514
import static datadog.trace.agent.test.utils.TraceUtils.basicSpan
16-
import static datadog.trace.api.sampling.PrioritySampling.*
17-
import static datadog.trace.api.sampling.SamplingMechanism.*
15+
import static datadog.trace.api.sampling.PrioritySampling.SAMPLER_DROP
16+
import static datadog.trace.api.sampling.PrioritySampling.SAMPLER_KEEP
17+
import static datadog.trace.api.sampling.PrioritySampling.UNSET
18+
import static datadog.trace.api.sampling.PrioritySampling.USER_DROP
19+
import static datadog.trace.api.sampling.PrioritySampling.USER_KEEP
20+
import static datadog.trace.api.sampling.SamplingMechanism.AGENT_RATE
21+
import static datadog.trace.api.sampling.SamplingMechanism.DEFAULT
22+
import static datadog.trace.api.sampling.SamplingMechanism.MANUAL
1823

1924
// This test focuses on things that are different between OpenTracing API 0.32.0 and 0.33.0
2025
class OT33ApiTest extends DDSpecification {
@@ -66,26 +71,6 @@ class OT33ApiTest extends DDSpecification {
6671
span.finish()
6772
}
6873

69-
def "test custom scopemanager"() {
70-
setup:
71-
def customTracer = DDTracer.builder().writer(writer).scopeManager(new ThreadLocalScopeManager()).build()
72-
def coreTracer = customTracer.tracer
73-
74-
when:
75-
def span = customTracer.buildSpan("some name").start()
76-
def scope = customTracer.scopeManager().activate(span)
77-
78-
then:
79-
customTracer.activeSpan().delegate == span.delegate
80-
coreTracer.activeScope().span() == span.delegate
81-
coreTracer.activeSpan() == span.delegate
82-
83-
cleanup:
84-
scope.close()
85-
span.finish()
86-
customTracer.close()
87-
}
88-
8974
def "test inject extract"() {
9075
setup:
9176
def span = tracer.buildSpan("some name").start()

‎dd-trace-ot/src/test/groovy/datadog/opentracing/CustomScopeManagerTest.groovy

-350
This file was deleted.

‎dd-trace-ot/src/test/groovy/datadog/opentracing/DDTracerTest.groovy

+17-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
package datadog.opentracing
22

3-
3+
import datadog.trace.common.sampling.Sampler
44
import datadog.trace.common.writer.DDAgentWriter
55
import datadog.trace.common.writer.ListWriter
6+
import datadog.trace.common.writer.Writer
67
import datadog.trace.test.util.DDSpecification
78

89
class DDTracerTest extends DDSpecification {
@@ -18,6 +19,21 @@ class DDTracerTest extends DDSpecification {
1819
tracer.close()
1920
}
2021

22+
def "test deprecated tracer constructor"() {
23+
setup:
24+
def tracers = []
25+
26+
when:
27+
tracers << new DDTracer()
28+
tracers << new DDTracer('serviceName')
29+
tracers << new DDTracer('serviceName', Mock(Writer), Mock(Sampler))
30+
tracers << new DDTracer('serviceName', Mock(Writer), Mock(Sampler), [:])
31+
tracers << new DDTracer(Mock(Writer))
32+
33+
then:
34+
tracers.each { assert it != null }
35+
}
36+
2137
def "test tracer builder with default writer"() {
2238
when:
2339
def tracer = DDTracer.builder().writer(DDAgentWriter.builder().build()).build()

‎dd-trace-ot/src/test/groovy/datadog/opentracing/IterationSpansForkedTest.groovy

+11-18
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,8 @@ import datadog.trace.core.CoreTracer
77
import datadog.trace.core.DDSpan
88
import datadog.trace.test.util.DDSpecification
99
import io.opentracing.ScopeManager
10-
import spock.util.concurrent.PollingConditions
1110

1211
class IterationSpansForkedTest extends DDSpecification {
13-
def conditions = new PollingConditions(timeout: 10, initialDelay: 0.1)
14-
1512
ListWriter writer
1613
DDTracer tracer
1714
ScopeManager scopeManager
@@ -23,8 +20,8 @@ class IterationSpansForkedTest extends DDSpecification {
2320

2421
writer = new ListWriter()
2522
statsDClient = Mock()
26-
scopeManager = new TestScopeManager()
27-
tracer = DDTracer.builder().writer(writer).statsDClient(statsDClient).scopeManager(scopeManager).build()
23+
tracer = DDTracer.builder().writer(writer).statsDClient(statsDClient).build()
24+
scopeManager = tracer.scopeManager()
2825
coreTracer = tracer.tracer
2926
}
3027

@@ -43,7 +40,7 @@ class IterationSpansForkedTest extends DDSpecification {
4340

4441
and:
4542
scope1.span() == span1
46-
scopeManager.active() == scope1.scope
43+
scopeManager.active().delegate == scope1
4744
!spanFinished(span1)
4845

4946
when:
@@ -57,7 +54,7 @@ class IterationSpansForkedTest extends DDSpecification {
5754

5855
and:
5956
scope2.span() == span2
60-
scopeManager.active() == scope2.scope
57+
scopeManager.active().delegate == scope2
6158
!spanFinished(span2)
6259

6360
when:
@@ -72,7 +69,7 @@ class IterationSpansForkedTest extends DDSpecification {
7269

7370
and:
7471
scope3.span() == span3
75-
scopeManager.active() == scope3.scope
72+
scopeManager.active().delegate == scope3
7673
!spanFinished(span3)
7774

7875
when:
@@ -99,7 +96,7 @@ class IterationSpansForkedTest extends DDSpecification {
9996

10097
and:
10198
scope1.span() == span1
102-
scopeManager.active() == scope1.scope
99+
scopeManager.active().delegate == scope1
103100
!spanFinished(span1)
104101

105102
when:
@@ -113,7 +110,7 @@ class IterationSpansForkedTest extends DDSpecification {
113110

114111
and:
115112
scope2.span() == span2
116-
scopeManager.active() == scope2.scope
113+
scopeManager.active().delegate == scope2
117114
!spanFinished(span2)
118115

119116
when:
@@ -127,13 +124,9 @@ class IterationSpansForkedTest extends DDSpecification {
127124

128125
and:
129126
scope3.span() == span3
130-
scopeManager.active() == scope3.scope
127+
scopeManager.active().delegate == scope3
131128
!spanFinished(span3)
132129

133-
when:
134-
// 'next3' should time out & finish after 1s
135-
conditions.eventually { assert spanFinished(span3) }
136-
137130
// close and finish the surrounding (non-iteration) span to complete the trace
138131
scope0.close()
139132
span0.finish()
@@ -157,7 +150,7 @@ class IterationSpansForkedTest extends DDSpecification {
157150

158151
and:
159152
scope1.span() == span1
160-
scopeManager.active() == scope1.scope
153+
scopeManager.active().delegate == scope1
161154
!spanFinished(span1)
162155

163156
when:
@@ -175,7 +168,7 @@ class IterationSpansForkedTest extends DDSpecification {
175168

176169
and:
177170
scope1A1.span() == span1A1
178-
scopeManager.active() == scope1A1.scope
171+
scopeManager.active().delegate == scope1A1
179172
!spanFinished(span1A1)
180173

181174
when:
@@ -189,7 +182,7 @@ class IterationSpansForkedTest extends DDSpecification {
189182

190183
and:
191184
scope1A2.span() == span1A2
192-
scopeManager.active() == scope1A2.scope
185+
scopeManager.active().delegate == scope1A2
193186
!spanFinished(span1A2)
194187

195188
when:

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

-21
This file was deleted.

0 commit comments

Comments
 (0)
Please sign in to comment.