diff options
author | Diego <diegolparra@gmail.com> | 2014-04-30 00:35:07 -0300 |
---|---|---|
committer | Diego <diegolparra@gmail.com> | 2014-04-30 00:35:07 -0300 |
commit | b260e19fac6fc85822c53abc4688e90b6166a0af (patch) | |
tree | e90d30ab846f0df6da073b82d3b1481b9c117dc7 /kamon-core/src/main/scala/akka/instrumentation | |
parent | 0952d2b6f4e571d2c949966131d857083bcdb5bd (diff) | |
download | Kamon-b260e19fac6fc85822c53abc4688e90b6166a0af.tar.gz Kamon-b260e19fac6fc85822c53abc4688e90b6166a0af.tar.bz2 Kamon-b260e19fac6fc85822c53abc4688e90b6166a0af.zip |
! core: new counter recorder based on LongAdder
Diffstat (limited to 'kamon-core/src/main/scala/akka/instrumentation')
-rw-r--r-- | kamon-core/src/main/scala/akka/instrumentation/ActorMessagePassingTracing.scala | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/kamon-core/src/main/scala/akka/instrumentation/ActorMessagePassingTracing.scala b/kamon-core/src/main/scala/akka/instrumentation/ActorMessagePassingTracing.scala index e52a66b2..ae9d20f6 100644 --- a/kamon-core/src/main/scala/akka/instrumentation/ActorMessagePassingTracing.scala +++ b/kamon-core/src/main/scala/akka/instrumentation/ActorMessagePassingTracing.scala @@ -24,6 +24,7 @@ import kamon.metrics.{ ActorMetrics, Metrics } import kamon.Kamon import kamon.metrics.ActorMetrics.ActorMetricRecorder import java.util.concurrent.atomic.AtomicInteger +import kamon.metrics.instruments.Counter @Aspect class BehaviourInvokeTracing { @@ -32,7 +33,7 @@ class BehaviourInvokeTracing { def actorCellCreation(cell: ActorCell, system: ActorSystem, ref: ActorRef, props: Props, dispatcher: MessageDispatcher, parent: ActorRef): Unit = {} @After("actorCellCreation(cell, system, ref, props, dispatcher, parent)") - def afterCreation(cell: ActorCell, system: ActorSystem, ref: ActorRef, props: Props, dispatcher: MessageDispatcher, parent: ActorRef): Unit = { + def afterCreation(cell: ActorCellMetrics, system: ActorSystem, ref: ActorRef, props: Props, dispatcher: MessageDispatcher, parent: ActorRef): Unit = { val metricsExtension = Kamon(Metrics)(system) val metricIdentity = ActorMetrics(ref.path.elements.mkString("/")) val cellWithMetrics = cell.asInstanceOf[ActorCellMetrics] @@ -89,6 +90,16 @@ class BehaviourInvokeTracing { val cellWithMetrics = cell.asInstanceOf[ActorCellMetrics] cellWithMetrics.actorMetricsRecorder.map(p ⇒ Kamon(Metrics)(cell.system).unregister(cellWithMetrics.metricIdentity)) } + + @Pointcut("execution(* akka.actor.ActorCell.handleInvokeFailure(..)) && this(cell)") + def actorInvokeFailure(cell: ActorCellMetrics): Unit = {} + + @Before("actorInvokeFailure(cell)") + def beforeInvokeFailure(cell: ActorCellMetrics): Unit = { + cell.actorMetricsRecorder.map { + am ⇒ am.errorCounter.record(1L) + } + } } trait ActorCellMetrics { |