Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Datadog context is not passed inside virtual threads.

Open
#9,984 0 comments 0 reactions 0 assignees View on GitHub

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

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

comp: context propagation type: bug report
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from DataDog/dd-trace-java

All issues in DataDog/dd-trace-java

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.