-
Notifications
You must be signed in to change notification settings - Fork 319
Open
Labels
comp: context propagationTrace context propagationTrace context propagationtype: bugBug report and fixBug report and fix
Description
Tracer Version(s)
1.55
Java Version(s)
24.0.2
JVM Vendor
Amazon Corretto
Bug Report
We have Spring Boot 3.5.7 with Spring GraphQL + using Spring HTTP Interfacases for requests. With enabled virtual threads there are no datadog trace id inside GraphQL execution context in in outbound requests made by Spring HTTP Interfaces.
To fix that we created custom code to manually pass datadog context inside virtual threads with TaskDecorator:
import datadog.trace.api.GlobalTracer;
import datadog.trace.api.Tracer;
import datadog.trace.context.TraceScope;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.task.TaskDecorator;
@Configuration
public class TracingConfiguration {
@Bean
public TaskDecorator datadogContextPropagatingTaskDecorator() {
return runnable -> {
Tracer tracer = GlobalTracer.get();
TraceScope.Continuation continuation = tracer.captureActiveSpan();
return () -> {
if (continuation != null) {
try (TraceScope scope = continuation.activate()) {
runnable.run();
}
} else {
runnable.run();
}
};
};
}
}Expected Behavior
datadog agent automaticaly passes own context inside virtual threads and doesn't require manual context passing with custom code.
Reproduction Code
No response
Metadata
Metadata
Assignees
Labels
comp: context propagationTrace context propagationTrace context propagationtype: bugBug report and fixBug report and fix