diff options
author | Ivan Topolnjak <ivantopo@gmail.com> | 2013-10-02 09:03:42 -0300 |
---|---|---|
committer | Ivan Topolnjak <ivantopo@gmail.com> | 2013-10-02 09:03:42 -0300 |
commit | 03c6a7d81e38dfa856ede9a188467b2c01bfb5f1 (patch) | |
tree | 3b7aa37c0e9f642a6cf2606e09bf37292ccd5bd5 /kamon-core/src/main/scala/kamon | |
parent | bf3273587f13f45ac4228b72c8a72628feb60f65 (diff) | |
download | Kamon-03c6a7d81e38dfa856ede9a188467b2c01bfb5f1.tar.gz Kamon-03c6a7d81e38dfa856ede9a188467b2c01bfb5f1.tar.bz2 Kamon-03c6a7d81e38dfa856ede9a188467b2c01bfb5f1.zip |
wip
Diffstat (limited to 'kamon-core/src/main/scala/kamon')
3 files changed, 22 insertions, 9 deletions
diff --git a/kamon-core/src/main/scala/kamon/TraceContext.scala b/kamon-core/src/main/scala/kamon/TraceContext.scala index 4ad533fd..0dfc1630 100644 --- a/kamon-core/src/main/scala/kamon/TraceContext.scala +++ b/kamon-core/src/main/scala/kamon/TraceContext.scala @@ -22,10 +22,11 @@ object TraceContext { val traceIdCounter = new AtomicLong def apply()(implicit system: ActorSystem) = { - val actor = system.actorOf(UowTraceAggregator.props(reporter, 5 seconds), s"tracer-${traceIdCounter.incrementAndGet()}") + val n = traceIdCounter.incrementAndGet() + val actor = system.actorOf(UowTraceAggregator.props(reporter, 5 seconds), s"tracer-${n}") actor ! Start() - new TraceContext(100, actor) // TODO: Move to a kamon specific supervisor, like /user/kamon/tracer + new TraceContext(n, actor) // TODO: Move to a kamon specific supervisor, like /user/kamon/tracer } } diff --git a/kamon-core/src/main/scala/kamon/instrumentation/RunnableInstrumentation.scala b/kamon-core/src/main/scala/kamon/instrumentation/RunnableInstrumentation.scala index 393293f1..bff118d9 100644 --- a/kamon-core/src/main/scala/kamon/instrumentation/RunnableInstrumentation.scala +++ b/kamon-core/src/main/scala/kamon/instrumentation/RunnableInstrumentation.scala @@ -58,8 +58,8 @@ class RunnableInstrumentation { @Around("runnableExecution()") def around(pjp: ProceedingJoinPoint) = { import pjp._ - /*if(traceContext.isEmpty) - println("OOHHH NOOOOO")*/ + if(traceContext.isEmpty) + println("NOMONEY") 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 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") } |