diff options
author | Carlos Ferreyra <cferreyra@despegar.com> | 2013-12-26 14:39:36 -0300 |
---|---|---|
committer | Carlos Ferreyra <cferreyra@despegar.com> | 2013-12-26 14:39:36 -0300 |
commit | 5606d35cb9f06ac655ea2abc4f0aa2e53c892b0f (patch) | |
tree | bf7370d3290fef942de875d169db392640fb9db2 /kamon-spray/src/main/scala | |
parent | da5f0b89ab1912c84f948872fa54bef761ffe173 (diff) | |
download | Kamon-5606d35cb9f06ac655ea2abc4f0aa2e53c892b0f.tar.gz Kamon-5606d35cb9f06ac655ea2abc4f0aa2e53c892b0f.tar.bz2 Kamon-5606d35cb9f06ac655ea2abc4f0aa2e53c892b0f.zip |
Added new respondWithUow directive to add the X-UOW header back in the response.
Changed ActorLogging to just propagate the trace context (does not add to the MDC anymore).
Created UowConverter to let logback know where the extract the UOW from.
Diffstat (limited to 'kamon-spray/src/main/scala')
-rw-r--r-- | kamon-spray/src/main/scala/kamon/spray/UowDirectives.scala | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/kamon-spray/src/main/scala/kamon/spray/UowDirectives.scala b/kamon-spray/src/main/scala/kamon/spray/UowDirectives.scala index b4ff1877..44db55e7 100644 --- a/kamon-spray/src/main/scala/kamon/spray/UowDirectives.scala +++ b/kamon-spray/src/main/scala/kamon/spray/UowDirectives.scala @@ -21,6 +21,7 @@ import java.util.concurrent.atomic.AtomicLong import scala.util.Try import java.net.InetAddress import kamon.trace.Trace +import spray.http.HttpHeaders.RawHeader trait UowDirectives extends BasicDirectives { def uow: Directive0 = mapRequest { request ⇒ @@ -30,6 +31,7 @@ trait UowDirectives extends BasicDirectives { Trace.transformContext(_.copy(uow = generatedUow)) request } + def respondWithUow = mapHttpResponseHeaders(headers ⇒ Trace.context().map(ctx ⇒ RawHeader("X-UOW", ctx.uow) :: headers).getOrElse(headers)) } object UowDirectives { @@ -37,4 +39,4 @@ object UowDirectives { val hostnamePrefix = Try(InetAddress.getLocalHost.getHostName).getOrElse("unknown-localhost") def newUow = "%s-%s".format(hostnamePrefix, uowCounter.incrementAndGet()) -}
\ No newline at end of file +} |