GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Remove custom scope manager support by PerfectSlayer · Pull Request #8164 · DataDog/dd-trace-java

Remove custom scope manager support #8164

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Sign up for GitHub

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
PerfectSlayer merged 2 commits into master from bbujon/dd-trace-ot-cleanup
Jan 8, 2025

Uh oh!

There was an error while loading. Please reload this page.

Merged

Remove custom scope manager support #8164

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
2 commits
Select commit Hold shift + click to select a range
d6d6049
chore(ot): Remove custom scope manager support
PerfectSlayer Jan 8, 2025
a2125e2
chore(core): Remove custom scope manager support
PerfectSlayer Jan 8, 2025
File filter
Filter by extension

Clear filters
Conversations
Failed to load comments.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Jump to
Jump to file
Failed to load files.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Diff view
Diff view

There are no files selected for viewing

33 changes: 10 additions & 23 deletions 33 dd-trace-core/src/main/java/datadog/trace/core/CoreTracer.java
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
import datadog.trace.bootstrap.instrumentation.api.AgentHistogram;
import datadog.trace.bootstrap.instrumentation.api.AgentPropagation;
import datadog.trace.bootstrap.instrumentation.api.AgentScope;
import datadog.trace.bootstrap.instrumentation.api.AgentScopeManager;
import datadog.trace.bootstrap.instrumentation.api.AgentSpan;
import datadog.trace.bootstrap.instrumentation.api.AgentSpanLink;
import datadog.trace.bootstrap.instrumentation.api.AgentTracer;
Expand Down Expand Up @@ -165,7 +164,7 @@ public static CoreTracerBuilder builder() {
/** Sampler defines the sampling policy in order to reduce the number of traces for instance */
final Sampler initialSampler;
/** Scope manager is in charge of managing the scopes from which spans are created */
final AgentScopeManager scopeManager;
final ContinuableScopeManager scopeManager;

final MetricsAggregator metricsAggregator;

Expand Down Expand Up @@ -295,7 +294,7 @@ public static class CoreTracerBuilder {
private SingleSpanSampler singleSpanSampler;
private HttpCodec.Injector injector;
private HttpCodec.Extractor extractor;
private AgentScopeManager scopeManager;
private ContinuableScopeManager scopeManager;
private Map<String, ?> localRootSpanTags;
private Map<String, ?> defaultSpanTags;
private Map<String, String> serviceNameMappings;
Expand Down Expand Up @@ -356,11 +355,6 @@ public CoreTracerBuilder extractor(HttpCodec.Extractor extractor) {
return this;
}

public CoreTracerBuilder scopeManager(AgentScopeManager scopeManager) {
this.scopeManager = scopeManager;
return this;
}

public CoreTracerBuilder localRootSpanTags(Map<String, ?> localRootSpanTags) {
this.localRootSpanTags = tryMakeImmutableMap(localRootSpanTags);
return this;
Expand Down Expand Up @@ -497,7 +491,6 @@ public CoreTracer build() {
singleSpanSampler,
injector,
extractor,
scopeManager,
localRootSpanTags,
defaultSpanTags,
serviceNameMappings,
Expand Down Expand Up @@ -529,7 +522,6 @@ private CoreTracer(
final SingleSpanSampler singleSpanSampler,
final HttpCodec.Injector injector,
final HttpCodec.Extractor extractor,
final AgentScopeManager scopeManager,
final Map<String, ?> localRootSpanTags,
final Map<String, ?> defaultSpanTags,
final Map<String, String> serviceNameMappings,
Expand Down Expand Up @@ -632,16 +624,13 @@ private CoreTracer(
: Monitoring.DISABLED;

traceWriteTimer = performanceMonitoring.newThreadLocalTimer("trace.write");
if (scopeManager == null) {
this.scopeManager =
new ContinuableScopeManager(
config.getScopeDepthLimit(),
config.isScopeStrictMode(),
profilingContextIntegration,
healthMetrics);
} else {
this.scopeManager = scopeManager;
}

scopeManager =
new ContinuableScopeManager(
config.getScopeDepthLimit(),
config.isScopeStrictMode(),
profilingContextIntegration,
healthMetrics);

externalAgentLauncher = new ExternalAgentLauncher(config);

Expand Down Expand Up @@ -1108,9 +1097,7 @@ public DataStreamsCheckpointer getDataStreamsCheckpointer() {

@Override
public void addScopeListener(final ScopeListener listener) {
if (scopeManager instanceof ContinuableScopeManager) {
((ContinuableScopeManager) scopeManager).addScopeListener(listener);
}
this.scopeManager.addScopeListener(listener);
}

@Override
Expand Down
11 changes: 2 additions & 9 deletions 11 dd-trace-core/src/main/java/datadog/trace/core/scopemanager/ContinuableScopeManager.java
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
import datadog.trace.api.scopemanager.ExtendedScopeListener;
import datadog.trace.api.scopemanager.ScopeListener;
import datadog.trace.bootstrap.instrumentation.api.AgentScope;
import datadog.trace.bootstrap.instrumentation.api.AgentScopeManager;
import datadog.trace.bootstrap.instrumentation.api.AgentSpan;
import datadog.trace.bootstrap.instrumentation.api.AgentTracer;
import datadog.trace.bootstrap.instrumentation.api.ProfilerContext;
import datadog.trace.bootstrap.instrumentation.api.ProfilingContextIntegration;
import datadog.trace.bootstrap.instrumentation.api.ScopeSource;
import datadog.trace.bootstrap.instrumentation.api.ScopeState;
import datadog.trace.bootstrap.instrumentation.api.ScopeStateAware;
import datadog.trace.core.monitor.HealthMetrics;
import datadog.trace.relocate.api.RatelimitedLogger;
import datadog.trace.util.AgentTaskScheduler;
Expand All @@ -37,7 +37,7 @@
* from being reported even if all related spans are finished. It also delegates to other
* ScopeInterceptors to provide additional functionality.
*/
public final class ContinuableScopeManager implements AgentScopeManager {
public final class ContinuableScopeManager implements ScopeStateAware {
static final Logger log = LoggerFactory.getLogger(ContinuableScopeManager.class);
static final RatelimitedLogger ratelimitedLog = new RatelimitedLogger(log, 1, MINUTES);
static final long iterationKeepAlive =
Expand Down Expand Up @@ -81,18 +81,15 @@ public ContinuableScopeManager(
this.profilingContextIntegration = profilingContextIntegration;
}

@Override
public AgentScope activate(final AgentSpan span, final ScopeSource source) {
return activate(span, source.id(), false, /* ignored */ false);
}

@Override
public AgentScope activate(
final AgentSpan span, final ScopeSource source, boolean isAsyncPropagating) {
return activate(span, source.id(), true, isAsyncPropagating);
}

@Override
public AgentScope.Continuation captureSpan(final AgentSpan span) {
AbstractContinuation continuation =
new SingleContinuation(this, span, ScopeSource.INSTRUMENTATION.id());
Expand Down Expand Up @@ -170,7 +167,6 @@ ContinuableScope continueSpan(
return scope;
}

@Override
public void closePrevious(final boolean finishSpan) {
ScopeStack scopeStack = scopeStack();

Expand All @@ -189,7 +185,6 @@ public void closePrevious(final boolean finishSpan) {
}
}

@Override
public AgentScope activateNext(final AgentSpan span) {
ScopeStack scopeStack = scopeStack();

Expand Down Expand Up @@ -220,12 +215,10 @@ public AgentScope activateNext(final AgentSpan span) {
return scope;
}

@Override
public AgentScope active() {
return scopeStack().active();
}

@Override
public AgentSpan activeSpan() {
final ContinuableScope active = scopeStack().active();
return active == null ? null : active.span;
Expand Down
Loading
Oops, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.