diff options
author | Ivan Topolnjak <ivantopo@gmail.com> | 2014-01-28 01:25:51 -0300 |
---|---|---|
committer | Ivan Topolnjak <ivantopo@gmail.com> | 2014-01-28 01:25:51 -0300 |
commit | e31ed96edbdf61ea0e20e879ec013400f4ef17ec (patch) | |
tree | 735f8c132ba7187b20e11856f9bc97b570970972 /kamon-core/src/main/scala/akka | |
parent | 966ba65ee12bdc60b231d421ab9d31b7c050b630 (diff) | |
download | Kamon-e31ed96edbdf61ea0e20e879ec013400f4ef17ec.tar.gz Kamon-e31ed96edbdf61ea0e20e879ec013400f4ef17ec.tar.bz2 Kamon-e31ed96edbdf61ea0e20e879ec013400f4ef17ec.zip |
store actor metrics in the new metrics extension
Diffstat (limited to 'kamon-core/src/main/scala/akka')
-rw-r--r-- | kamon-core/src/main/scala/akka/instrumentation/ActorMessagePassingTracing.scala | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/kamon-core/src/main/scala/akka/instrumentation/ActorMessagePassingTracing.scala b/kamon-core/src/main/scala/akka/instrumentation/ActorMessagePassingTracing.scala index 68d606ba..d43de311 100644 --- a/kamon-core/src/main/scala/akka/instrumentation/ActorMessagePassingTracing.scala +++ b/kamon-core/src/main/scala/akka/instrumentation/ActorMessagePassingTracing.scala @@ -17,12 +17,14 @@ package akka.instrumentation import org.aspectj.lang.annotation._ import org.aspectj.lang.ProceedingJoinPoint -import akka.actor.{ Cell, Props, ActorSystem, ActorRef } +import akka.actor._ import akka.dispatch.{ Envelope, MessageDispatcher } import kamon.trace.{ TraceContext, ContextAware, Trace } -import kamon.metrics.{ ActorMetrics, HdrActorMetricsRecorder, Metrics } +import kamon.metrics.{ ActorMetrics, Metrics } import kamon.Kamon import kamon.metrics.ActorMetrics.ActorMetricRecorder +import kamon.trace.TraceContext +import kamon.metrics.ActorMetrics.ActorMetricRecorder @Aspect("perthis(actorCellCreation(*, *, *, *, *))") class BehaviourInvokeTracing { @@ -40,11 +42,11 @@ class BehaviourInvokeTracing { actorMetrics = metricsExtension.register(path, ActorMetrics) } - @Pointcut("(execution(* akka.actor.ActorCell.invoke(*)) || execution(* akka.routing.RoutedActorCell.sendMessage(*))) && args(envelope)") - def invokingActorBehaviourAtActorCell(envelope: Envelope) = {} + @Pointcut("(execution(* akka.actor.ActorCell.invoke(*)) || execution(* akka.routing.RoutedActorCell.sendMessage(*))) && this(cell) && args(envelope)") + def invokingActorBehaviourAtActorCell(cell: ActorCell, envelope: Envelope) = {} - @Around("invokingActorBehaviourAtActorCell(envelope)") - def aroundBehaviourInvoke(pjp: ProceedingJoinPoint, envelope: Envelope): Unit = { + @Around("invokingActorBehaviourAtActorCell(cell, envelope)") + def aroundBehaviourInvoke(pjp: ProceedingJoinPoint, cell: ActorCell, envelope: Envelope): Unit = { val timestampBeforeProcessing = System.nanoTime() val contextAndTimestamp = envelope.asInstanceOf[ContextAndTimestampAware] @@ -55,6 +57,7 @@ class BehaviourInvokeTracing { actorMetrics.map { am ⇒ am.processingTime.record(System.nanoTime() - timestampBeforeProcessing) am.timeInMailbox.record(timestampBeforeProcessing - contextAndTimestamp.timestamp) + am.mailboxSize.record(cell.numberOfMessages) } } |