Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ ContinuableScope continueSpan(

public boolean isAsyncPropagationEnabled() {
ContinuableScope activeScope = scopeStack().active();
return activeScope != null && activeScope.isAsyncPropagating();
return activeScope == null || activeScope.isAsyncPropagating();
}

public void setAsyncPropagationEnabled(boolean asyncPropagationEnabled) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,20 @@ void cleanup() {
tracer.close();
}

@Test
void noActiveScopeDefaultsToAsyncPropagation() {
assertNull(scopeManager.active());
assertTrue(tracer.isAsyncPropagationEnabled());

Context context = Context.root().with(ContextKey.named("test-key"), "value");
ContextContinuation continuation = tracer.capture(context);
try {
assertSame(context, continuation.context());
} finally {
continuation.release();
}
}

@Test
void nonDdspanActivationResultsInAContinuableScope() {
ContextScope scope = scopeManager.activateSpan(noopSpan());
Expand Down
Loading