Skip to content

Commit

Permalink
Remove internal dd.trace.scope.inherit.async.propagation feature fl…
Browse files Browse the repository at this point in the history
…ag (#7958)

This flag was added in #1850 (v0.64.0) in case we needed to revert the fixed behaviour, but we have never needed to do that.
  • Loading branch information
mcculls authored Nov 15, 2024
1 parent f19e110 commit 92eab56
Show file tree
Hide file tree
Showing 9 changed files with 9 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class TypeConverterTest extends AgentTestRunner {
}

def "should avoid extra allocation for a scope wrapper"() {
def scopeManager = new ContinuableScopeManager(0, false, true)
def scopeManager = new ContinuableScopeManager(0, false)
def context = createTestSpanContext()
def span1 = new DDSpan("test", 0, context, null)
def span2 = new DDSpan("test", 0, context, null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class TypeConverterTest extends AgentTestRunner {
}

def "should avoid extra allocation for a scope wrapper"() {
def scopeManager = new ContinuableScopeManager(0, false, true)
def scopeManager = new ContinuableScopeManager(0, false)
def context = createTestSpanContext()
def span1 = new DDSpan("test", 0, context, null)
def span2 = new DDSpan("test", 0, context, null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class TypeConverterTest extends AgentTestRunner {
}

def "should avoid extra allocation for a scope wrapper"() {
def scopeManager = new ContinuableScopeManager(0, false, true)
def scopeManager = new ContinuableScopeManager(0, false)
def context = createTestSpanContext()
def span1 = new DDSpan("test", 0, context, null)
def span2 = new DDSpan("test", 0, context, null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,6 @@ public final class TracerConfig {

public static final String SCOPE_DEPTH_LIMIT = "trace.scope.depth.limit";
public static final String SCOPE_STRICT_MODE = "trace.scope.strict.mode";
public static final String SCOPE_INHERIT_ASYNC_PROPAGATION =
"trace.scope.inherit.async.propagation";
public static final String SCOPE_ITERATION_KEEP_ALIVE = "trace.scope.iteration.keep.alive";
public static final String PARTIAL_FLUSH_ENABLED = "trace.partial.flush.enabled";
public static final String PARTIAL_FLUSH_MIN_SPANS = "trace.partial.flush.min.spans";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,6 @@ private CoreTracer(
new ContinuableScopeManager(
config.getScopeDepthLimit(),
config.isScopeStrictMode(),
config.isScopeInheritAsyncPropagation(),
profilingContextIntegration,
healthMetrics);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ public final class ContinuableScopeManager implements AgentScopeManager {
final boolean strictMode;
private final ScopeStackThreadLocal tlsScopeStack;
private final int depthLimit;
private final boolean inheritAsyncPropagation;
final HealthMetrics healthMetrics;
private final ProfilingContextIntegration profilingContextIntegration;

Expand All @@ -57,36 +56,24 @@ public final class ContinuableScopeManager implements AgentScopeManager {
*
* @param depthLimit The maximum scope depth limit, <code>0</code> for unlimited.
* @param strictMode Whether check if the closed spans are the active ones or not.
* @param inheritAsyncPropagation Whether the next span should inherit the active span
* asyncPropagation flag.
*/
public ContinuableScopeManager(
final int depthLimit, final boolean strictMode, final boolean inheritAsyncPropagation) {
this(
depthLimit,
strictMode,
inheritAsyncPropagation,
ProfilingContextIntegration.NoOp.INSTANCE,
HealthMetrics.NO_OP);
public ContinuableScopeManager(final int depthLimit, final boolean strictMode) {
this(depthLimit, strictMode, ProfilingContextIntegration.NoOp.INSTANCE, HealthMetrics.NO_OP);
}

/**
* Default constructor.
*
* @param depthLimit The maximum scope depth limit, <code>0</code> for unlimited.
* @param strictMode Whether check if the closed spans are the active ones or not.
* @param inheritAsyncPropagation Whether the next span should inherit the active span
* asyncPropagation flag.
*/
public ContinuableScopeManager(
final int depthLimit,
final boolean strictMode,
final boolean inheritAsyncPropagation,
final ProfilingContextIntegration profilingContextIntegration,
final HealthMetrics healthMetrics) {
this.depthLimit = depthLimit == 0 ? Integer.MAX_VALUE : depthLimit;
this.strictMode = strictMode;
this.inheritAsyncPropagation = inheritAsyncPropagation;
this.scopeListeners = new CopyOnWriteArrayList<>();
this.extendedScopeListeners = new CopyOnWriteArrayList<>();
this.healthMetrics = healthMetrics;
Expand Down Expand Up @@ -141,9 +128,7 @@ private AgentScope activate(
boolean asyncPropagation =
overrideAsyncPropagation
? isAsyncPropagating
: inheritAsyncPropagation && top != null
? top.isAsyncPropagating()
: DEFAULT_ASYNC_PROPAGATING;
: top != null ? top.isAsyncPropagating() : DEFAULT_ASYNC_PROPAGATING;

final ContinuableScope scope =
new ContinuableScope(this, span, source, asyncPropagation, createScopeState(span));
Expand Down Expand Up @@ -219,10 +204,7 @@ public AgentScope activateNext(final AgentSpan span) {

final ContinuableScope top = scopeStack.top;

boolean asyncPropagation =
inheritAsyncPropagation && top != null
? top.isAsyncPropagating()
: DEFAULT_ASYNC_PROPAGATING;
boolean asyncPropagation = top != null ? top.isAsyncPropagating() : DEFAULT_ASYNC_PROPAGATING;

final ContinuableScope scope =
new ContinuableScope(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class PendingTraceBufferTest extends DDSpecification {

def tracer = Mock(CoreTracer)
def traceConfig = Mock(CoreTracer.ConfigSnapshot)
def scopeManager = new ContinuableScopeManager(10, true, true)
def scopeManager = new ContinuableScopeManager(10, true)
def factory = new PendingTrace.Factory(tracer, bufferSpy, SystemTimeSource.INSTANCE, false, HealthMetrics.NO_OP)
List<TraceScope.Continuation> continuations = []

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class TypeConverterTest extends DDSpecification {
}

def "should avoid extra allocation for a scope wrapper"() {
def scopeManager = new ContinuableScopeManager(0, false, true)
def scopeManager = new ContinuableScopeManager(0, false)
def context = createTestSpanContext()
def span1 = new DDSpan("test", 0, context, null)
def span2 = new DDSpan("test", 0, context, null)
Expand Down
9 changes: 0 additions & 9 deletions internal-api/src/main/java/datadog/trace/api/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,6 @@ public static String getHostName() {
private final Set<String> splitByTags;
private final int scopeDepthLimit;
private final boolean scopeStrictMode;
private final boolean scopeInheritAsyncPropagation;
private final int scopeIterationKeepAlive;
private final int partialFlushMinSpans;
private final boolean traceStrictWritesEnabled;
Expand Down Expand Up @@ -854,8 +853,6 @@ private Config(final ConfigProvider configProvider, final InstrumenterConfig ins

scopeStrictMode = configProvider.getBoolean(SCOPE_STRICT_MODE, false);

scopeInheritAsyncPropagation = configProvider.getBoolean(SCOPE_INHERIT_ASYNC_PROPAGATION, true);

scopeIterationKeepAlive =
configProvider.getInteger(SCOPE_ITERATION_KEEP_ALIVE, DEFAULT_SCOPE_ITERATION_KEEP_ALIVE);

Expand Down Expand Up @@ -2073,10 +2070,6 @@ public boolean isScopeStrictMode() {
return scopeStrictMode;
}

public boolean isScopeInheritAsyncPropagation() {
return scopeInheritAsyncPropagation;
}

public int getScopeIterationKeepAlive() {
return scopeIterationKeepAlive;
}
Expand Down Expand Up @@ -4168,8 +4161,6 @@ public String toString() {
+ scopeDepthLimit
+ ", scopeStrictMode="
+ scopeStrictMode
+ ", scopeInheritAsyncPropagation="
+ scopeInheritAsyncPropagation
+ ", scopeIterationKeepAlive="
+ scopeIterationKeepAlive
+ ", partialFlushMinSpans="
Expand Down

0 comments on commit 92eab56

Please sign in to comment.