diff options
Diffstat (limited to 'kamon-spray/src/main')
-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 +} |