OpenTracing for Play Framework
This project is cross-versioned against Play. The Play version appears as a suffix.
// Play 2.3.x-2.4.x
libraryDependencies += "com.lucidchart" % "opentracing-play-active" % "<version>-2.3"
// Play 2.5.x
libraryDependencies += "com.lucidchart" % "opentracing-play-active" % "<version>-2.5"
This project ThreadContextSpan
and
GlobalTracer
.
To propagate the thread-local span, add akka-thread-context as
a dependency and configure Akka to use DispatchConfigurator
.
akka.actor.default-dispatcher.type = com.lucidchart.akka.threadcontext.DefaultDispatcherConfigurator
Add TracingFilter
, specifying the SpanTagger
s that you want.
import io.opentracing.play.active
class Filters extends DefaultHttpFilters(
new DefaultTracingFilter(
new ContentTagger, // content headers
new HttpVersionTagger, // HTTP version
new StandardSpanTagger, // standard OpenTracing tags
new TagsSpanTagger(_ => true) // Play request tags
)
)