diff options
author | Ivan Topolnak <ivantopo@gmail.com> | 2013-05-30 18:32:41 -0300 |
---|---|---|
committer | Ivan Topolnak <ivantopo@gmail.com> | 2013-05-30 18:32:41 -0300 |
commit | 148827486f116c4196888022f04ad053f4fb6e99 (patch) | |
tree | e0cdf5982e778b2e49790bda1572a861884d83f2 /src/main/scala/kamon/instrumentation | |
parent | 38316a2b0b3a58b81cf7458b0a719980136bbb97 (diff) | |
download | Kamon-148827486f116c4196888022f04ad053f4fb6e99.tar.gz Kamon-148827486f116c4196888022f04ad053f4fb6e99.tar.bz2 Kamon-148827486f116c4196888022f04ad053f4fb6e99.zip |
WIP - first functional implementation of TraceContext
Diffstat (limited to 'src/main/scala/kamon/instrumentation')
-rw-r--r-- | src/main/scala/kamon/instrumentation/RunnableInstrumentation.scala (renamed from src/main/scala/kamon/instrumentation/PromiseCompletingRunnableInstrumentation.scala) | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/src/main/scala/kamon/instrumentation/PromiseCompletingRunnableInstrumentation.scala b/src/main/scala/kamon/instrumentation/RunnableInstrumentation.scala index ce19a7e6..ef908625 100644 --- a/src/main/scala/kamon/instrumentation/PromiseCompletingRunnableInstrumentation.scala +++ b/src/main/scala/kamon/instrumentation/RunnableInstrumentation.scala @@ -1,7 +1,7 @@ package kamon.instrumentation import org.aspectj.lang.annotation._ -import kamon.TraceContext +import kamon.{Kamon, TraceContext} import org.aspectj.lang.ProceedingJoinPoint import scala.Some @@ -12,7 +12,7 @@ trait TraceContextAwareRunnable extends Runnable {} @Aspect("perthis(instrumentedRunnableCreation())") -class PromiseCompletingRunnableInstrumentation { +class RunnableInstrumentation { /** * These are the Runnables that need to be instrumented and make the TraceContext available @@ -37,25 +37,19 @@ class PromiseCompletingRunnableInstrumentation { * Aspect members */ - private val traceContext = TraceContext.current + private val traceContext = Kamon.context /** * Advices */ + import kamon.TraceContextSwap.withContext @Around("runnableExecution()") def around(pjp: ProceedingJoinPoint) = { import pjp._ - traceContext match { - case Some(ctx) => { - TraceContext.set(ctx) - proceed() - TraceContext.clear - } - case None => proceed() - } + withContext(traceContext, proceed()) } } |