|
51 | 51 | import datadog.trace.bootstrap.instrumentation.api.AgentHistogram;
|
52 | 52 | import datadog.trace.bootstrap.instrumentation.api.AgentPropagation;
|
53 | 53 | import datadog.trace.bootstrap.instrumentation.api.AgentScope;
|
54 |
| -import datadog.trace.bootstrap.instrumentation.api.AgentScopeManager; |
55 | 54 | import datadog.trace.bootstrap.instrumentation.api.AgentSpan;
|
56 | 55 | import datadog.trace.bootstrap.instrumentation.api.AgentSpanLink;
|
57 | 56 | import datadog.trace.bootstrap.instrumentation.api.AgentTracer;
|
@@ -165,7 +164,7 @@ public static CoreTracerBuilder builder() {
|
165 | 164 | /** Sampler defines the sampling policy in order to reduce the number of traces for instance */
|
166 | 165 | final Sampler initialSampler;
|
167 | 166 | /** Scope manager is in charge of managing the scopes from which spans are created */
|
168 |
| - final AgentScopeManager scopeManager; |
| 167 | + final ContinuableScopeManager scopeManager; |
169 | 168 |
|
170 | 169 | final MetricsAggregator metricsAggregator;
|
171 | 170 |
|
@@ -295,7 +294,7 @@ public static class CoreTracerBuilder {
|
295 | 294 | private SingleSpanSampler singleSpanSampler;
|
296 | 295 | private HttpCodec.Injector injector;
|
297 | 296 | private HttpCodec.Extractor extractor;
|
298 |
| - private AgentScopeManager scopeManager; |
| 297 | + private ContinuableScopeManager scopeManager; |
299 | 298 | private Map<String, ?> localRootSpanTags;
|
300 | 299 | private Map<String, ?> defaultSpanTags;
|
301 | 300 | private Map<String, String> serviceNameMappings;
|
@@ -356,11 +355,6 @@ public CoreTracerBuilder extractor(HttpCodec.Extractor extractor) {
|
356 | 355 | return this;
|
357 | 356 | }
|
358 | 357 |
|
359 |
| - public CoreTracerBuilder scopeManager(AgentScopeManager scopeManager) { |
360 |
| - this.scopeManager = scopeManager; |
361 |
| - return this; |
362 |
| - } |
363 |
| - |
364 | 358 | public CoreTracerBuilder localRootSpanTags(Map<String, ?> localRootSpanTags) {
|
365 | 359 | this.localRootSpanTags = tryMakeImmutableMap(localRootSpanTags);
|
366 | 360 | return this;
|
@@ -497,7 +491,6 @@ public CoreTracer build() {
|
497 | 491 | singleSpanSampler,
|
498 | 492 | injector,
|
499 | 493 | extractor,
|
500 |
| - scopeManager, |
501 | 494 | localRootSpanTags,
|
502 | 495 | defaultSpanTags,
|
503 | 496 | serviceNameMappings,
|
@@ -529,7 +522,6 @@ private CoreTracer(
|
529 | 522 | final SingleSpanSampler singleSpanSampler,
|
530 | 523 | final HttpCodec.Injector injector,
|
531 | 524 | final HttpCodec.Extractor extractor,
|
532 |
| - final AgentScopeManager scopeManager, |
533 | 525 | final Map<String, ?> localRootSpanTags,
|
534 | 526 | final Map<String, ?> defaultSpanTags,
|
535 | 527 | final Map<String, String> serviceNameMappings,
|
@@ -632,16 +624,13 @@ private CoreTracer(
|
632 | 624 | : Monitoring.DISABLED;
|
633 | 625 |
|
634 | 626 | 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); |
645 | 634 |
|
646 | 635 | externalAgentLauncher = new ExternalAgentLauncher(config);
|
647 | 636 |
|
@@ -1108,9 +1097,7 @@ public DataStreamsCheckpointer getDataStreamsCheckpointer() {
|
1108 | 1097 |
|
1109 | 1098 | @Override
|
1110 | 1099 | public void addScopeListener(final ScopeListener listener) {
|
1111 |
| - if (scopeManager instanceof ContinuableScopeManager) { |
1112 |
| - ((ContinuableScopeManager) scopeManager).addScopeListener(listener); |
1113 |
| - } |
| 1100 | + this.scopeManager.addScopeListener(listener); |
1114 | 1101 | }
|
1115 | 1102 |
|
1116 | 1103 | @Override
|
|
0 commit comments