diff options
author | Ivan Topolnak <itopolnak@despegar.com> | 2014-01-27 19:09:40 -0300 |
---|---|---|
committer | Ivan Topolnak <itopolnak@despegar.com> | 2014-01-27 19:09:40 -0300 |
commit | 966ba65ee12bdc60b231d421ab9d31b7c050b630 (patch) | |
tree | 6024c787845d098224a0485527ec015279920afb /kamon-core/src/main/scala/akka/instrumentation | |
parent | 633b4058207d084724743c6b6367ac60f95ff987 (diff) | |
download | Kamon-966ba65ee12bdc60b231d421ab9d31b7c050b630.tar.gz Kamon-966ba65ee12bdc60b231d421ab9d31b7c050b630.tar.bz2 Kamon-966ba65ee12bdc60b231d421ab9d31b7c050b630.zip |
first implementation of a universal metrics repository for any kind of metrics we might be interested in
Diffstat (limited to 'kamon-core/src/main/scala/akka/instrumentation')
-rw-r--r-- | kamon-core/src/main/scala/akka/instrumentation/ActorMessagePassingTracing.scala | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/kamon-core/src/main/scala/akka/instrumentation/ActorMessagePassingTracing.scala b/kamon-core/src/main/scala/akka/instrumentation/ActorMessagePassingTracing.scala index 6cede344..68d606ba 100644 --- a/kamon-core/src/main/scala/akka/instrumentation/ActorMessagePassingTracing.scala +++ b/kamon-core/src/main/scala/akka/instrumentation/ActorMessagePassingTracing.scala @@ -20,26 +20,24 @@ import org.aspectj.lang.ProceedingJoinPoint import akka.actor.{ Cell, Props, ActorSystem, ActorRef } import akka.dispatch.{ Envelope, MessageDispatcher } import kamon.trace.{ TraceContext, ContextAware, Trace } -import kamon.metrics.{ HdrActorMetricsRecorder, ActorMetrics } +import kamon.metrics.{ ActorMetrics, HdrActorMetricsRecorder, Metrics } import kamon.Kamon +import kamon.metrics.ActorMetrics.ActorMetricRecorder @Aspect("perthis(actorCellCreation(*, *, *, *, *))") class BehaviourInvokeTracing { - var path: Option[String] = None - var actorMetrics: Option[HdrActorMetricsRecorder] = None + var path: String = _ + var actorMetrics: Option[ActorMetricRecorder] = None @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 = {} @After("actorCellCreation(system, ref, props, dispatcher, parent)") def afterCreation(system: ActorSystem, ref: ActorRef, props: Props, dispatcher: MessageDispatcher, parent: ActorRef): Unit = { - val metricsExtension = Kamon(ActorMetrics)(system) - val simplePathString = ref.path.elements.mkString("/") + val metricsExtension = Kamon(Metrics)(system) - if (metricsExtension.shouldTrackActor(simplePathString)) { - path = Some(ref.path.toString) - actorMetrics = Some(metricsExtension.registerActor(simplePathString)) - } + path = ref.path.elements.mkString("/") + actorMetrics = metricsExtension.register(path, ActorMetrics) } @Pointcut("(execution(* akka.actor.ActorCell.invoke(*)) || execution(* akka.routing.RoutedActorCell.sendMessage(*))) && args(envelope)") @@ -55,8 +53,8 @@ class BehaviourInvokeTracing { } actorMetrics.map { am ⇒ - am.recordProcessingTime(System.nanoTime() - timestampBeforeProcessing) - am.recordTimeInMailbox(timestampBeforeProcessing - contextAndTimestamp.timestamp) + am.processingTime.record(System.nanoTime() - timestampBeforeProcessing) + am.timeInMailbox.record(timestampBeforeProcessing - contextAndTimestamp.timestamp) } } @@ -65,7 +63,7 @@ class BehaviourInvokeTracing { @After("actorStop(cell)") def afterStop(cell: Cell): Unit = { - path.map(p ⇒ Kamon(ActorMetrics)(cell.system).unregisterActor(p)) + actorMetrics.map(p ⇒ Kamon(Metrics)(cell.system).unregister(path, ActorMetrics)) } } |