I am trying to use the Scala instrumentation and asyncTrace to track a transaction in Scala code. One of the Futures is ultimately backed by a Scala Promise that is completed by another thread pool. When I have one of these futures in the chain offlatMaps, subsequent operations are not captured in the transaction.
Similar behavior happens if a Future started outside the transaction is included in the flatMap chain.
(Specifically, the Future is the result of an Akka Stream, but I can reproduce the issue without using Akka).
Expected Behavior
I expect my async traces to work regardless of how the Futures involved in it are created/completed.
During my testing I found I could recover the transaction by explicitly linking the transaction with a token, but I needed to nest a Future oddly to make it work.
Description
I am trying to use the Scala instrumentation and
asyncTrace
to track a transaction in Scala code. One of the Futures is ultimately backed by a ScalaPromise
that is completed by another thread pool. When I have one of these futures in the chain offlatMap
s, subsequent operations are not captured in the transaction.Similar behavior happens if a Future started outside the transaction is included in the flatMap chain.
(Specifically, the Future is the result of an Akka Stream, but I can reproduce the issue without using Akka).
Expected Behavior
I expect my async traces to work regardless of how the Futures involved in it are created/completed.
Steps to Reproduce
This repository reproduces the issue: https://github.com/jmreardon-yoppworks/new-relic-promises
During my testing I found I could recover the transaction by explicitly linking the transaction with a token, but I needed to nest a Future oddly to make it work.
Your Environment
Mac OS Intel