From 66957f2632eaccae4e3a354b8787fded8c6369d2 Mon Sep 17 00:00:00 2001 From: Ivan Topolnak Date: Thu, 8 Aug 2013 15:18:35 -0300 Subject: wip --- kamon-core/src/main/resources/application.conf | 22 +++------------------- .../src/main/scala/kamon/TraceContextSwap.scala | 4 ++-- .../ActorRefTellInstrumentation.scala | 20 ++++++++++++++------ .../instrumentation/RunnableInstrumentation.scala | 4 ++-- 4 files changed, 21 insertions(+), 29 deletions(-) (limited to 'kamon-core') diff --git a/kamon-core/src/main/resources/application.conf b/kamon-core/src/main/resources/application.conf index 370acae9..fb69ecd4 100644 --- a/kamon-core/src/main/resources/application.conf +++ b/kamon-core/src/main/resources/application.conf @@ -1,4 +1,7 @@ akka { + loglevel = DEBUG + stdout-loglevel = DEBUG + log-dead-letters = on actor { default-dispatcher { fork-join-executor { @@ -19,25 +22,6 @@ akka { } } -# Dispatcher is the name of the event-based dispatcher -#type = Dispatcher - -# What kind of ExecutionService to use -#executor = "kamon.executor.InstrumentedExecutorServiceConfigurator" - -# Min number of threads to cap factor-based parallelism number to -#parallelism-min = 2 - -# Parallelism (threads) ... ceil(available processors * factor) -#parallelism-factor = 2.0 - -# Max number of threads to cap factor-based parallelism number to -#parallelism-max = 10 - -# Throughput defines the maximum number of messages to be -# processed per actor before the thread jumps to the next actor. -# Set to 1 for as fair as possible. -#throughput = 100 diff --git a/kamon-core/src/main/scala/kamon/TraceContextSwap.scala b/kamon-core/src/main/scala/kamon/TraceContextSwap.scala index 68ee808b..24661445 100644 --- a/kamon-core/src/main/scala/kamon/TraceContextSwap.scala +++ b/kamon-core/src/main/scala/kamon/TraceContextSwap.scala @@ -10,9 +10,9 @@ trait TraceContextSwap { def withContext[A](ctx: Option[TraceContext], primary: => A, fallback: => A): A = { ctx match { case Some(context) => { - Kamon.set(context) + Tracer.set(context) val bodyResult = primary - Kamon.clear + Tracer.clear bodyResult } diff --git a/kamon-core/src/main/scala/kamon/instrumentation/ActorRefTellInstrumentation.scala b/kamon-core/src/main/scala/kamon/instrumentation/ActorRefTellInstrumentation.scala index 82915ce9..c543123c 100644 --- a/kamon-core/src/main/scala/kamon/instrumentation/ActorRefTellInstrumentation.scala +++ b/kamon-core/src/main/scala/kamon/instrumentation/ActorRefTellInstrumentation.scala @@ -3,12 +3,11 @@ package kamon.instrumentation import org.aspectj.lang.annotation._ import org.aspectj.lang.ProceedingJoinPoint import akka.actor.{Props, ActorSystem, ActorRef} -import kamon.{Kamon, TraceContext} +import kamon.{Tracer, TraceContext} import akka.dispatch.{MessageDispatcher, Envelope} import com.codahale.metrics.{Timer, ExponentiallyDecayingReservoir, Histogram} import kamon.metric.{MetricDirectory, Metrics} import com.codahale.metrics -import kamon.instrumentation.TraceableMessage import scala.Some case class TraceableMessage(traceContext: Option[TraceContext], message: Any, timer: Timer.Context) @@ -18,7 +17,7 @@ case class TraceableMessage(traceContext: Option[TraceContext], message: Any, ti class ActorRefTellInstrumentation { import ProceedingJoinPointPimp._ - @Pointcut("execution(* akka.actor.ScalaActorRef+.$bang(..)) && target(actor) && args(message, sender)") + @Pointcut("execution(* (akka.actor.ScalaActorRef+ && !akka.event.Logging$StandardOutLogger).$bang(..)) && target(actor) && args(message, sender)") def sendingMessageToActorRef(actor: ActorRef, message: Any, sender: ActorRef) = {} @Around("sendingMessageToActorRef(actor, message, sender)") @@ -27,7 +26,15 @@ class ActorRefTellInstrumentation { val actorName = MetricDirectory.nameForActor(actor) val t = Metrics.registry.timer(actorName + "LATENCY") //println(s"About to proceed with: $actor $message $sender ${Kamon.context}") - pjp.proceedWithTarget(actor, TraceableMessage(Kamon.context, message, t.time()), sender) + if(!actor.toString().contains("StandardOutLogger")) { + println("Skipped the actor") + pjp.proceedWithTarget(actor, TraceableMessage(Tracer.context, message, t.time()), sender) + + } + else { + println("Got the standardLogger!!") + pjp.proceed() + } } } @@ -48,6 +55,7 @@ class ActorCellInvokeInstrumentation { val actorName = MetricDirectory.nameForActor(ref) val histogramName = MetricDirectory.nameForMailbox(system.name, actorName) + println("=====> Created ActorCell for: "+ref.toString()) /** TODO: Find a better way to filter the things we don't want to measure. */ //if(system.name != "kamon" && actorName.startsWith("/user")) { processingTimeTimer = Metrics.registry.timer(histogramName + "/PROCESSINGTIME") @@ -74,10 +82,10 @@ class ActorCellInvokeInstrumentation { val pt = processingTimeTimer.time() ctx match { case Some(c) => { - Kamon.set(c) + Tracer.set(c) println(s"ENVELOPE ORIGINAL: [$c]---------------->"+originalEnvelope) pjp.proceedWith(originalEnvelope) - Kamon.clear + Tracer.clear } case None => pjp.proceedWith(originalEnvelope) } diff --git a/kamon-core/src/main/scala/kamon/instrumentation/RunnableInstrumentation.scala b/kamon-core/src/main/scala/kamon/instrumentation/RunnableInstrumentation.scala index e75a638f..30041321 100644 --- a/kamon-core/src/main/scala/kamon/instrumentation/RunnableInstrumentation.scala +++ b/kamon-core/src/main/scala/kamon/instrumentation/RunnableInstrumentation.scala @@ -1,7 +1,7 @@ package kamon.instrumentation import org.aspectj.lang.annotation._ -import kamon.{Kamon, TraceContext} +import kamon.{Tracer, TraceContext} import org.aspectj.lang.ProceedingJoinPoint import scala.Some @@ -37,7 +37,7 @@ class RunnableInstrumentation { * Aspect members */ - private val traceContext = Kamon.context + private val traceContext = Tracer.context /** -- cgit v1.2.3