openzipkin-contrib / play-zipkin-tracing

Provides distributed tracing for Play Framework and Akka using Zipkin.
Apache License 2.0
48 stars 19 forks source link

support overriding context #18

Open LarryFinn opened 7 years ago

LarryFinn commented 7 years ago

currently my play application uses finagle to communicate with other services. i would like to use the finaggle context in the tracer so that everything lines up. the problem is that the version of brave in this lib is too old to set the context of the tracer. it would be great if we could configure the tracing context like

Tracer tracer = Tracing.newBuilder()
        .currentTraceContext(new FinagleCurrentTraceContext()).build().tracer();
shimamoto commented 7 years ago

You are right. The version of brave is old. OK, we will handle this soon.

takezoe commented 7 years ago

@LarryFinn 1.2.0-SNAPSHOT has been deployed to the sonatype snapshot repository: https://oss.sonatype.org/content/repositories/snapshots/

Using this snapshot, you can do it by overriding ZipkinTraceService.tracing, and create an alternative module of ZipkinModule to bind your extended class to ZipkinTraceServiceLike.

Could you try it? If it works fine, we will release 1.2.0 after some extra fixes.

codefromthecrypt commented 7 years ago

curious on this, would we need to do something to hook brave Tracing.currentTraceContext() to the akka dispatcher's executor somehow? It seems like if we didn't asynchronous code would lose the context (which might be backed by finagle implementation)

http://doc.akka.io/docs/akka/current/scala/dispatchers.html#types-of-dispatchers

takezoe commented 7 years ago

Hmm... I'm not sure about Finagle implementation, so I don't know clearly what do we have to do to propagate the context between Play and Finagle.

@LarryFinn Do you have any advice?

codefromthecrypt commented 7 years ago

Naoki, so one thing to experiment with is using Brave's log4j or slf4j integration. If an async callback doesn't show up in the logs then the context isn't being used properly. Once this works, finagle will work (as it is also a plugin like slf4j)