dd-trace-java
dd-trace-java copied to clipboard
Using akka streams to parallelize requests loses linked traces
Trying to make multiple requests to a service. When I do it in a list , the context is preserved and the traces show up in datadog. Whereas if they're done via akka streams, the connection is lost and the traces are still there, but no longer connected to the route.
val reqs: Seq[HttpRequest] = Seq(req1, req2, req3)
val makeRequests: Seq[Future[HttpResponse]] = reqs.map(Http().singleRequest(_))
val completeReqs: Future[Seq[HttpResponse]] = Future.sequence(makeRequests)
works.
whereas
val reqs: Seq[HttpRequest] = Seq(req1, req2, req3)
val completeReqs: Future[Seq[HttpResponse]] = Source(reqs).mapAsync(1)(Http().singleRequest(_)).runWith(Sink.seq)
loses the traces.
Hi @Marcus-Rosti - we don't yet support trace propagation over akka-streams, you would need to use manual instrumentation to do that: https://docs.datadoghq.com/tracing/setup_overview/custom_instrumentation/java/#adding-spans
@mcculls what context would I have to add from the calling threard to actorsystem/materializer to keep the trace?
@Marcus-Rosti, have you succeeded with trace propagation over akka-streams? I would appreciate it if you could share anything.