aboutsummaryrefslogtreecommitdiff
path: root/kamon-trace/src/main
diff options
context:
space:
mode:
authorIvan Topolnjak <ivantopo@gmail.com>2013-11-23 21:57:27 -0300
committerIvan Topolnjak <ivantopo@gmail.com>2013-11-23 21:57:27 -0300
commitf9b596754feb657f1130eebd0cc4ac2a5e741518 (patch)
treeb3dab1bd1591e2ab045eab28dc7db4db0b9f743d /kamon-trace/src/main
parent6ba7487204e0339437c7279e6330fc03419a2c5c (diff)
downloadKamon-f9b596754feb657f1130eebd0cc4ac2a5e741518.tar.gz
Kamon-f9b596754feb657f1130eebd0cc4ac2a5e741518.tar.bz2
Kamon-f9b596754feb657f1130eebd0cc4ac2a5e741518.zip
Little clean up to actor message passing tracing
Diffstat (limited to 'kamon-trace/src/main')
-rw-r--r--kamon-trace/src/main/resources/META-INF/aop.xml4
-rw-r--r--kamon-trace/src/main/scala/kamon/trace/instrumentation/ActorMessagePassingTracing.scala (renamed from kamon-trace/src/main/scala/kamon/trace/instrumentation/ActorRefTellInstrumentation.scala)20
2 files changed, 13 insertions, 11 deletions
diff --git a/kamon-trace/src/main/resources/META-INF/aop.xml b/kamon-trace/src/main/resources/META-INF/aop.xml
index fdc1c496..090cac42 100644
--- a/kamon-trace/src/main/resources/META-INF/aop.xml
+++ b/kamon-trace/src/main/resources/META-INF/aop.xml
@@ -2,8 +2,12 @@
<aspectj>
<aspects>
+ <aspect name="kamon.trace.instrumentation.EnvelopeTraceContextMixin"/>
+ <aspect name="kamon.trace.instrumentation.BehaviourInvokeTracing"/>
+
<aspect name="kamon.trace.instrumentation.FutureTracing" />
+
<include within="scala.concurrent..*"/>
<include within="akka..*"/>
<include within="spray..*"/>
diff --git a/kamon-trace/src/main/scala/kamon/trace/instrumentation/ActorRefTellInstrumentation.scala b/kamon-trace/src/main/scala/kamon/trace/instrumentation/ActorMessagePassingTracing.scala
index 057e339d..9eb0a7f9 100644
--- a/kamon-trace/src/main/scala/kamon/trace/instrumentation/ActorRefTellInstrumentation.scala
+++ b/kamon-trace/src/main/scala/kamon/trace/instrumentation/ActorMessagePassingTracing.scala
@@ -7,11 +7,9 @@ import akka.dispatch.{Envelope, MessageDispatcher}
import com.codahale.metrics.Timer
import kamon.trace.{ContextAware, TraceContext, Trace}
-case class TraceableMessage(traceContext: Option[TraceContext], message: Any, timer: Timer.Context)
-case class DefaultTracingAwareEnvelopeContext(traceContext: Option[TraceContext] = Trace.traceContext.value, timestamp: Long = System.nanoTime) extends ContextAware
@Aspect
-class ActorCellInvokeInstrumentation {
+class BehaviourInvokeTracing {
@Pointcut("execution(akka.actor.ActorCell.new(..)) && args(system, ref, props, dispatcher, parent)")
def actorCellCreation(system: ActorSystem, ref: ActorRef, props: Props, dispatcher: MessageDispatcher, parent: ActorRef): Unit = {}
@@ -20,28 +18,28 @@ class ActorCellInvokeInstrumentation {
def invokingActorBehaviourAtActorCell(envelope: Envelope) = {}
@Around("invokingActorBehaviourAtActorCell(envelope)")
- def around(pjp: ProceedingJoinPoint, envelope: Envelope): Unit = {
+ def aroundBehaviourInvoke(pjp: ProceedingJoinPoint, envelope: Envelope): Unit = {
//safe cast
- val msgContext = envelope.asInstanceOf[ContextAware].traceContext
+ val ctxInMessage = envelope.asInstanceOf[ContextAware].traceContext
- Trace.traceContext.withValue(msgContext) {
+ Trace.withValue(ctxInMessage) {
pjp.proceed()
}
}
}
@Aspect
-class EnvelopeTracingContext {
+class EnvelopeTraceContextMixin {
@DeclareMixin("akka.dispatch.Envelope")
def mixin: ContextAware = ContextAware.default
@Pointcut("execution(akka.dispatch.Envelope.new(..)) && this(ctx)")
- def requestRecordInit(ctx: ContextAware): Unit = {}
+ def envelopeCreation(ctx: ContextAware): Unit = {}
- @After("requestRecordInit(ctx)")
- def whenCreatedRequestRecord(ctx: ContextAware): Unit = {
- // Necessary to force the initialization of TracingAwareRequestContext at the moment of creation.
+ @After("envelopeCreation(ctx)")
+ def afterEnvelopeCreation(ctx: ContextAware): Unit = {
+ // Necessary to force the initialization of ContextAware at the moment of creation.
ctx.traceContext
}
}