diff options
author | Ivan Topolnjak <ivantopo@gmail.com> | 2014-01-27 09:11:32 -0300 |
---|---|---|
committer | Ivan Topolnjak <ivantopo@gmail.com> | 2014-01-27 09:11:32 -0300 |
commit | 003af1dd8ef1e3b4a8f1a9eff56a3c15c01cb2a9 (patch) | |
tree | e0afcb7d2358787f16c5b19e8caceaab5d6ea1ca /kamon-spray/src/main/scala/spray/can | |
parent | fc13a7e4abf87c92d63cb7b13561119b6414651e (diff) | |
download | Kamon-003af1dd8ef1e3b4a8f1a9eff56a3c15c01cb2a9.tar.gz Kamon-003af1dd8ef1e3b4a8f1a9eff56a3c15c01cb2a9.tar.bz2 Kamon-003af1dd8ef1e3b4a8f1a9eff56a3c15c01cb2a9.zip |
rename UOW to TraceToken and generate it by default when a Trace starts
Diffstat (limited to 'kamon-spray/src/main/scala/spray/can')
-rw-r--r-- | kamon-spray/src/main/scala/spray/can/server/ServerRequestTracing.scala | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/kamon-spray/src/main/scala/spray/can/server/ServerRequestTracing.scala b/kamon-spray/src/main/scala/spray/can/server/ServerRequestTracing.scala index 91dba87b..a7d48ac8 100644 --- a/kamon-spray/src/main/scala/spray/can/server/ServerRequestTracing.scala +++ b/kamon-spray/src/main/scala/spray/can/server/ServerRequestTracing.scala @@ -37,9 +37,16 @@ class ServerRequestTracing { @After("openRequestInit(openRequest, request)") def afterInit(openRequest: ContextAware, request: HttpRequest): Unit = { val system: ActorSystem = openRequest.asInstanceOf[OpenRequest].context.actorContext.system + val config = system.settings.config.getConfig("kamon.spray") + + val token = if(config.getBoolean("include-trace-token-header")) { + val traceTokenHeader = config.getString("trace-token-header-name") + request.headers.find(_.name == traceTokenHeader).map(_.value) + } else None + val defaultTraceName: String = request.method.value + ": " + request.uri.path - Trace.start(defaultTraceName)(system) + Trace.start(defaultTraceName, token)(system) // Necessary to force initialization of traceContext when initiating the request. openRequest.traceContext |