8000 Supporting Baggage for Instrumentations used in Weblog Tests by mhlidd · Pull Request #8773 · DataDog/dd-trace-java · GitHub
[go: up one dir, main page]

Skip to content

Supporting Baggage for Instrumentations used in Weblog Tests #8773

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.

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
merged 15 commits into from
May 20, 2025
Merged
Prev Previous commit
Next Next commit
updating tests
  • Loading branch information
mhlidd committed May 12, 2025
commit 0bb7df6225e0a6d58f2388caf904e80c4c27a904
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public static ContextScope onService(@Advice.Argument(0) org.apache.coyote.Reque

final AgentSpan span = DECORATE.startSpanFromContext("http-server", req, extractedContext);
final ContextScope scope = extractedContext.with(span).attach();
// final ContextScope scope = activateSpan(span);

// This span is finished when Request.recycle() is called by RequestInstrumentation.
DECORATE.afterStart(span);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1044,8 +1044,7 @@ abstract class HttpServerTest<SERVER> extends WithHttpServer<SERVER> {
if (isDataStreamsEnabled()) {
TEST_DATA_STREAMS_WRITER.waitForGroups(1)
}
// println(request)
// println(response)

expect:
if (bubblesResponse()) {
8000 assert response.code() == REDIRECT.status
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import datadog.trace.core.monitor.HealthMetrics;
import datadog.trace.relocate.api.RatelimitedLogger;
import datadog.trace.util.AgentTaskScheduler;
import de.thetaphi.forbiddenapis.SuppressForbidden;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -123,7 +122,6 @@ private AgentScope.Continuation captureSpan(Context context, byte source, AgentS
return new ScopeContinuation(this, context, source, traceCollector).register();
}

@SuppressForbidden
private AgentScope activate(
final AgentSpan span,
final byte source,
Expand Down Expand Up @@ -157,20 +155,12 @@ private AgentScope activate(

final ContinuableScope scope =
new ContinuableScope(this, context, source, asyncPropagation, createScopeState(context));
System.out.println("Scope size prior: " + scopeStack.depth());
scopeStack.push(scope);
System.out.println("Scope size prior: " + scopeStack.depth());
healthMetrics.onActivateScope();

if (iterationKeepAlive > 0 && currentDepth == 0) {
// For context-based scopes, only add them if they're going to be long-lived
scheduleRootIterationScopeCleanup(scopeStack, scope);
}

return scope;
}

@SuppressForbidden
private AgentScope activate(final Context context) {
ScopeStack scopeStack = scopeStack();

Expand All @@ -195,17 +185,9 @@ private AgentScope activate(final Context context) {

final ContinuableScope scope =
new ContinuableScope(this, context, CONTEXT, asyncPropagation, createScopeState(context));
System.out.println("Context: " + context);
System.out.println("Scope size prior: " + scopeStack.depth());
scopeStack.push(scope);
System.out.println("Scope size prior: " + scopeStack.depth());
healthMetrics.onActivateScope();

if (iterationKeepAlive > 0 && currentDepth == 0) {
// For context-based scopes, only add them if they're going to be long-lived
scheduleRootIterationScopeCleanup(scopeStack, scope);
}

return scope;
}

Expand Down Expand Up @@ -322,13 +304,8 @@ public void rollbackActiveToCheckpoint() {
}
}

@SuppressForbidden
public AgentSpan activeSpan() {
final ContinuableScope active = scopeStack().active();

System.out.println("Scope size prior: " + scopeStack().depth());
System.out.println("scopeStack(): " + scopeStack());
System.out.println("active: " + active);
return active == null ? null : active.span();
}

Expand Down
Loading
0