diff options
author | Carlos Ferreyra <crypticmind@gmail.com> | 2014-06-25 01:32:17 -0300 |
---|---|---|
committer | Carlos Ferreyra <cferreyra@despegar.com> | 2014-07-03 12:38:42 -0300 |
commit | 49945353319a2c11fa136512359738c5b854a788 (patch) | |
tree | 32e7a10b0583d881c95ba9b11bf8c7d01c0bd614 /kamon-core/src/main/scala/kamon/trace/TraceRecorder.scala | |
parent | 6d7970c6dd5b96b512c846181771bb11a43bc82a (diff) | |
download | Kamon-49945353319a2c11fa136512359738c5b854a788.tar.gz Kamon-49945353319a2c11fa136512359738c5b854a788.tar.bz2 Kamon-49945353319a2c11fa136512359738c5b854a788.zip |
= core: Inline variant of withTraceContext using macros.
Diffstat (limited to 'kamon-core/src/main/scala/kamon/trace/TraceRecorder.scala')
-rw-r--r-- | kamon-core/src/main/scala/kamon/trace/TraceRecorder.scala | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/kamon-core/src/main/scala/kamon/trace/TraceRecorder.scala b/kamon-core/src/main/scala/kamon/trace/TraceRecorder.scala index 0e264cd2..c57ac064 100644 --- a/kamon-core/src/main/scala/kamon/trace/TraceRecorder.scala +++ b/kamon-core/src/main/scala/kamon/trace/TraceRecorder.scala @@ -16,7 +16,10 @@ package kamon.trace +import scala.language.experimental.macros import java.util.concurrent.atomic.AtomicLong +import kamon.macros.InlineTraceContextMacro + import scala.util.Try import java.net.InetAddress import akka.actor.ActorSystem @@ -66,6 +69,8 @@ object TraceRecorder { try thunk finally setContext(oldContext) } + def withInlineTraceContextReplacement[T](traceCtx: Option[TraceContext])(thunk: ⇒ T): T = macro InlineTraceContextMacro.withInlineTraceContextImpl[T, Option[TraceContext]] + def finish(metadata: Map[String, String] = Map.empty): Unit = currentContext.map(_.finish(metadata)) } |