aboutsummaryrefslogtreecommitdiff
path: root/kamon-core/src/main/scala/kamon/instrumentation
diff options
context:
space:
mode:
authorIvan Topolnak <ivantopo@gmail.com>2013-11-04 18:11:16 -0300
committerIvan Topolnak <ivantopo@gmail.com>2013-11-04 18:11:16 -0300
commit84711adba09c64b75369f8b801819a90198238c6 (patch)
tree1e6193bf3248e82a85c1091110ba3b81d3f34036 /kamon-core/src/main/scala/kamon/instrumentation
parent227c2dfe6cb8b7e175ad72285dfdfbd15672be24 (diff)
downloadKamon-84711adba09c64b75369f8b801819a90198238c6.tar.gz
Kamon-84711adba09c64b75369f8b801819a90198238c6.tar.bz2
Kamon-84711adba09c64b75369f8b801819a90198238c6.zip
wip
Diffstat (limited to 'kamon-core/src/main/scala/kamon/instrumentation')
-rw-r--r--kamon-core/src/main/scala/kamon/instrumentation/RunnableInstrumentation.scala59
1 files changed, 0 insertions, 59 deletions
diff --git a/kamon-core/src/main/scala/kamon/instrumentation/RunnableInstrumentation.scala b/kamon-core/src/main/scala/kamon/instrumentation/RunnableInstrumentation.scala
deleted file mode 100644
index 2be6e5d1..00000000
--- a/kamon-core/src/main/scala/kamon/instrumentation/RunnableInstrumentation.scala
+++ /dev/null
@@ -1,59 +0,0 @@
-package kamon.instrumentation
-
-import org.aspectj.lang.annotation._
-import kamon.{Tracer}
-import org.aspectj.lang.ProceedingJoinPoint
-import scala.Some
-import kamon.trace.TraceContext
-
-/**
- * Marker interface, just to make sure we don't instrument all the Runnables in the classpath.
- */
-trait TraceContextAwareRunnable {
- def traceContext: Option[TraceContext]
-}
-
-
-@Aspect
-class RunnableInstrumentation {
-
- /**
- * These are the Runnables that need to be instrumented and make the TraceContext available
- * while their run method is executed.
- */
- @DeclareMixin("scala.concurrent.impl.CallbackRunnable || scala.concurrent.impl.Future.PromiseCompletingRunnable")
- def onCompleteCallbacksRunnable: TraceContextAwareRunnable = new TraceContextAwareRunnable {
- val traceContext: Option[TraceContext] = Tracer.traceContext.value
- }
-
-
- /**
- * Pointcuts
- */
-
- @Pointcut("execution(kamon.instrumentation.TraceContextAwareRunnable+.new(..)) && this(runnable)")
- def instrumentedRunnableCreation(runnable: TraceContextAwareRunnable): Unit = {}
-
- @Pointcut("execution(* kamon.instrumentation.TraceContextAwareRunnable+.run()) && this(runnable)")
- def runnableExecution(runnable: TraceContextAwareRunnable) = {}
-
-
-
- @After("instrumentedRunnableCreation(runnable)")
- def beforeCreation(runnable: TraceContextAwareRunnable): Unit = {
- // Force traceContext initialization.
- runnable.traceContext
- }
-
-
- @Around("runnableExecution(runnable)")
- def around(pjp: ProceedingJoinPoint, runnable: TraceContextAwareRunnable): Any = {
- import pjp._
-
- Tracer.traceContext.withValue(runnable.traceContext) {
- proceed()
- }
- }
-
-}
-