From 2bde052cc3a3a6eb97b72d3504cd7a4a40a5c2a8 Mon Sep 17 00:00:00 2001 From: Ivan Topolnak Date: Mon, 30 Sep 2013 11:21:25 -0300 Subject: wip --- .../instrumentation/ActorRefTellInstrumentation.scala | 14 +++++++++++--- .../kamon/instrumentation/RunnableInstrumentation.scala | 12 +++++++++--- .../kamon/instrumentation/SprayServerInstrumentation.scala | 8 ++++---- 3 files changed, 24 insertions(+), 10 deletions(-) (limited to 'kamon-core/src/main/scala/kamon') diff --git a/kamon-core/src/main/scala/kamon/instrumentation/ActorRefTellInstrumentation.scala b/kamon-core/src/main/scala/kamon/instrumentation/ActorRefTellInstrumentation.scala index d92d7f6c..df124f41 100644 --- a/kamon-core/src/main/scala/kamon/instrumentation/ActorRefTellInstrumentation.scala +++ b/kamon-core/src/main/scala/kamon/instrumentation/ActorRefTellInstrumentation.scala @@ -64,8 +64,11 @@ class ActorCellInvokeInstrumentation { Tracer.clear //MDC.remove("uow") } - case None => pjp.proceedWith(originalEnvelope) + case None => + assert(Tracer.context() == None) + pjp.proceedWith(originalEnvelope) } + Tracer.clear } } @@ -79,6 +82,7 @@ class UnregisteredActorRefInstrumentation { def sprayInvokeAround(pjp: ProceedingJoinPoint, message: Any, sender: ActorRef): Unit = { import ProceedingJoinPointPimp._ //println("Handling unregistered actor ref message: "+message) + message match { case SimpleTraceMessage(msg, ctx) => { ctx match { @@ -87,10 +91,14 @@ class UnregisteredActorRefInstrumentation { pjp.proceedWith(msg.asInstanceOf[AnyRef]) // TODO: define if we should use Any or AnyRef and unify with the rest of the instrumentation. Tracer.clear } - case None => pjp.proceedWith(msg.asInstanceOf[AnyRef]) + case None => + assert(Tracer.context() == None) + pjp.proceedWith(msg.asInstanceOf[AnyRef]) } } - case _ => pjp.proceed + case _ => + //assert(Tracer.context() == None) + pjp.proceed } } } diff --git a/kamon-core/src/main/scala/kamon/instrumentation/RunnableInstrumentation.scala b/kamon-core/src/main/scala/kamon/instrumentation/RunnableInstrumentation.scala index 30041321..393293f1 100644 --- a/kamon-core/src/main/scala/kamon/instrumentation/RunnableInstrumentation.scala +++ b/kamon-core/src/main/scala/kamon/instrumentation/RunnableInstrumentation.scala @@ -37,7 +37,7 @@ class RunnableInstrumentation { * Aspect members */ - private val traceContext = Tracer.context + private var traceContext = Tracer.context /** @@ -47,15 +47,21 @@ class RunnableInstrumentation { @Before("instrumentedRunnableCreation()") def beforeCreation = { - //println((new Throwable).getStackTraceString) + traceContext = Tracer.context + /* if(traceContext.isEmpty) + println("NO TRACE CONTEXT FOR RUNNABLE at: [[[%s]]]", (new Throwable).getStackTraceString)//println((new Throwable).getStackTraceString) + else + println("SUPER TRACE CONTEXT FOR RUNNABLE at: [[[%s]]]", (new Throwable).getStackTraceString)*/ } @Around("runnableExecution()") def around(pjp: ProceedingJoinPoint) = { import pjp._ - + /*if(traceContext.isEmpty) + println("OOHHH NOOOOO")*/ withContext(traceContext, proceed()) } } + diff --git a/kamon-core/src/main/scala/kamon/instrumentation/SprayServerInstrumentation.scala b/kamon-core/src/main/scala/kamon/instrumentation/SprayServerInstrumentation.scala index 9422a9f7..4eafcebe 100644 --- a/kamon-core/src/main/scala/kamon/instrumentation/SprayServerInstrumentation.scala +++ b/kamon-core/src/main/scala/kamon/instrumentation/SprayServerInstrumentation.scala @@ -32,7 +32,7 @@ class SprayServerInstrumentation { //def afterInit(): Unit = { Tracer.start //openRequest.traceContext - println("Created the context: " + Tracer.context() + " for the transaction: " + request) + //println("Created the context: " + Tracer.context() + " for the transaction: " + request) Tracer.context().map(_.entries ! Rename(request.uri.path.toString())) } @@ -41,13 +41,13 @@ class SprayServerInstrumentation { @After("openRequestCreation()") def afterFinishingRequest(): Unit = { - println("Finishing a request: " + Tracer.context()) + //println("Finishing a request: " + Tracer.context()) Tracer.context().map(_.entries ! Finish()) - +/* if(Tracer.context().isEmpty) { println("WOOOOOPAAAAAAAAA") - } + }*/ } -- cgit v1.2.3