Test propagation across non-tracing contexts
MODIFY
dd-java-agent-ittests/src/main/scala/datadog/trace/agent/integration/executors/ScalaConcurrentTests.scala
dd-java-agent-ittests/src/main/scala/datadog/trace/agent/integration/executors/ScalaConcurrentTests.scala
@@ -32,6 +32,22 @@ class ScalaConcurrentTests {
return 5
}
+ @Trace
+ def tracedAcrossThreadsWithNoTrace() :Integer = {
+ val goodFuture: Future[Integer] = Future {
+ 1
+ }
+ goodFuture onSuccess {
+ case _ => Future {
+ 2
+ } onSuccess {
+ case _ => tracedChild("callback")
+ }
+ }
+
+ return 2
+ }
+
/**
* @return Number of expected spans in the trace
*/

MODIFY
dd-java-agent-ittests/src/test/groovy/datadog/trace/agent/integration/executors/ExecutorInstrumentationTest.groovy
dd-java-agent-ittests/src/test/groovy/datadog/trace/agent/integration/executors/ExecutorInstrumentationTest.groovy
@@ -136,6 +136,17 @@ class ExecutorInstrumentationTest extends Specification {
trace.size() == expectedNumberOfSpans
}
+ def "scala propagates across futures with no traces"() {
+ setup:
+ ScalaConcurrentTests scalaTest = new ScalaConcurrentTests()
+ int expectedNumberOfSpans = scalaTest.tracedAcrossThreadsWithNoTrace()
+ testWriter.waitForTraces(1)
+ List<DDSpan> trace = testWriter.get(0)
+
+ expect:
+ trace.size() == expectedNumberOfSpans
+ }
+
def "scala either promise completion"() {
setup:
ScalaConcurrentTests scalaTest = new ScalaConcurrentTests()

Test propagation across non-tracing contexts