From 03c6a7d81e38dfa856ede9a188467b2c01bfb5f1 Mon Sep 17 00:00:00 2001 From: Ivan Topolnjak Date: Wed, 2 Oct 2013 09:03:42 -0300 Subject: wip --- .../SprayServerInstrumentation.scala | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'kamon-core/src/main/scala/kamon/instrumentation/SprayServerInstrumentation.scala') diff --git a/kamon-core/src/main/scala/kamon/instrumentation/SprayServerInstrumentation.scala b/kamon-core/src/main/scala/kamon/instrumentation/SprayServerInstrumentation.scala index 0299c4c5..06254739 100644 --- a/kamon-core/src/main/scala/kamon/instrumentation/SprayServerInstrumentation.scala +++ b/kamon-core/src/main/scala/kamon/instrumentation/SprayServerInstrumentation.scala @@ -32,20 +32,32 @@ class SprayServerInstrumentation { //@After("openRequestInit()") //def afterInit(): Unit = { Tracer.start + val discard = openRequest.asInstanceOf[ContextAware].traceContext + + //println("Reply: %s - %s ", Tracer.context().get.id, request.uri.path.toString()) + +// if(discard.isEmpty || discard != Tracer.context()) { +// println("MEGA ERROR") +// } //openRequest.traceContext //println("Created the context: " + Tracer.context() + " for the transaction: " + request) Tracer.context().map(_.entries ! Rename(request.uri.path.toString())) } - @Pointcut("execution(* spray.can.server.OpenRequestComponent$DefaultOpenRequest.handleResponseEndAndReturnNextOpenRequest(..))") - def openRequestCreation(): Unit = {} + @Pointcut("execution(* spray.can.server.OpenRequestComponent$DefaultOpenRequest.handleResponseEndAndReturnNextOpenRequest(..)) && target(openRequest)") + def openRequestCreation(openRequest: OpenRequest): Unit = {} - @After("openRequestCreation()") - def afterFinishingRequest(): Unit = { + @After("openRequestCreation(openRequest)") + def afterFinishingRequest(openRequest: OpenRequest): Unit = { // println("Finishing a request: " + Tracer.context()) - + val original = openRequest.asInstanceOf[ContextAware].traceContext + println("The original is: " + original + " - " + openRequest.request.uri.path) Tracer.context().map(_.entries ! Finish()) + if(Tracer.context() != original) { + println(s"OMG DIFFERENT Original: [${original}] - Came in: [${Tracer.context}]") + } + if(Tracer.context().isEmpty) { println("WOOOOOPAAAAAAAAA") } -- cgit v1.2.3