Datadog context is not passed inside virtual threads.
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Needs clarification
- Activity status
- Stale
- Tech stack
- java, spring-boot
- Domain
- backend, observability
Research direction
The issue names no repository files or tests and provides no reproduction code. Start by reproducing the Spring Boot 3.5.7, Spring GraphQL, Spring HTTP Interfaces, Java 24.0.2, and virtual-thread setup, then compare it with the custom TaskDecorator. Done means Datadog context reaches GraphQL execution and outbound Spring HTTP Interface requests without manual propagation.
Written by the indexing model from the issue text.
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
- Dominant language
- Java
- Stars
- 737
- Forks
- 361
- Avg merge
- 3d 20h
- Merged PRs (30d)
- 173
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from DataDog/dd-trace-java
-
type: feature request
Difficulty 1/5 1-3 hours Newbie friendliness 70/100
DataDog/dd-trace-java#10245 · 1 comment ·
-
Difficulty 4/5 3-5 days Newbie friendliness 62/100
DataDog/dd-trace-java#12608 ·
-
type: bug report
Difficulty 4/5 3-5 days Newbie friendliness 35/100
DataDog/dd-trace-java#12597 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
DataDog/dd-trace-java#12540 · 4 comments · 1 assignee ·
-
Difficulty 3/5 1-2 days Newbie friendliness 25/100
DataDog/dd-trace-java#12480 ·
All issues in DataDog/dd-trace-java
Similar issues
-
certification
Difficulty 1/5 Under an hour Newbie friendliness 80/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
[BUG] ECR GetAuthorizationToken returns a proxyEndpoint for the default region, not the request's Openbug ecr
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Needs: Triage Type: Feature request
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
AntennaPod/AntennaPod#8794 ·
-
agentic-workflows
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
github/copilot-sdk#2760 ·