play-zipkin-tracing icon indicating copy to clipboard operation
play-zipkin-tracing copied to clipboard

support overriding context

Open LarryFinn opened this issue 7 years ago • 5 comments

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();

LarryFinn avatar Jun 09 '17 03:06 LarryFinn

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

shimamoto avatar Jun 09 '17 08:06 shimamoto

@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.

takezoe avatar Jun 12 '17 16:06 takezoe

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

codefromthecrypt avatar Jun 15 '17 11:06 codefromthecrypt

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?

takezoe avatar Jun 15 '17 11:06 takezoe

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)

codefromthecrypt avatar Jun 15 '17 12:06 codefromthecrypt