diff options
author | Ivan Topolnjak <ivantopo@gmail.com> | 2014-07-03 13:48:24 -0300 |
---|---|---|
committer | Ivan Topolnjak <ivantopo@gmail.com> | 2014-07-03 13:48:24 -0300 |
commit | b0df3654cb82d87971fa67ff56a2e183dc93358f (patch) | |
tree | c2ab91b00751c4967ce3aa066c1428a70eb514cf /kamon-core/src/main | |
parent | 8bf93c1f26453ef298d965aaa8b9cb932f8b2a64 (diff) | |
parent | 69dbbb558737f482a1003fe35b19da7e8bd35309 (diff) | |
download | Kamon-b0df3654cb82d87971fa67ff56a2e183dc93358f.tar.gz Kamon-b0df3654cb82d87971fa67ff56a2e183dc93358f.tar.bz2 Kamon-b0df3654cb82d87971fa67ff56a2e183dc93358f.zip |
Merge remote-tracking branch 'crypticmind/master'
Diffstat (limited to 'kamon-core/src/main')
-rw-r--r-- | kamon-core/src/main/scala/kamon/instrumentation/FutureTracing.scala | 4 | ||||
-rw-r--r-- | kamon-core/src/main/scala/kamon/trace/TraceRecorder.scala | 5 |
2 files changed, 7 insertions, 2 deletions
diff --git a/kamon-core/src/main/scala/kamon/instrumentation/FutureTracing.scala b/kamon-core/src/main/scala/kamon/instrumentation/FutureTracing.scala index 634c94a1..b9424579 100644 --- a/kamon-core/src/main/scala/kamon/instrumentation/FutureTracing.scala +++ b/kamon-core/src/main/scala/kamon/instrumentation/FutureTracing.scala @@ -39,9 +39,9 @@ class FutureTracing { @Around("futureRelatedRunnableExecution(runnable)") def aroundExecution(pjp: ProceedingJoinPoint, runnable: TraceContextAware): Any = { - TraceRecorder.withTraceContext(runnable.traceContext) { + TraceRecorder.withInlineTraceContextReplacement(runnable.traceContext) { pjp.proceed() } } -}
\ No newline at end of file +} 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)) } |