aboutsummaryrefslogtreecommitdiff
path: root/kamon-core/src/main
diff options
context:
space:
mode:
authorDiego <diegolparra@gmail.com>2014-05-01 19:49:22 -0300
committerDiego <diegolparra@gmail.com>2014-05-01 19:49:22 -0300
commit80f8a5d0b3a6c936453645254c1349b9691b1df2 (patch)
treeada6f152bef39a3dacbd32d3cf56eef1bdbc0984 /kamon-core/src/main
parentb260e19fac6fc85822c53abc4688e90b6166a0af (diff)
downloadKamon-80f8a5d0b3a6c936453645254c1349b9691b1df2.tar.gz
Kamon-80f8a5d0b3a6c936453645254c1349b9691b1df2.tar.bz2
Kamon-80f8a5d0b3a6c936453645254c1349b9691b1df2.zip
! core: first implementetion of kamon counter intrument and actor errors metrics
Diffstat (limited to 'kamon-core/src/main')
-rw-r--r--kamon-core/src/main/scala/akka/instrumentation/ActorMessagePassingTracing.scala11
-rw-r--r--kamon-core/src/main/scala/kamon/metrics/instruments/CounterRecorder.scala4
2 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 ae9d20f6..78c170de 100644
--- a/kamon-core/src/main/scala/akka/instrumentation/ActorMessagePassingTracing.scala
+++ b/kamon-core/src/main/scala/akka/instrumentation/ActorMessagePassingTracing.scala
@@ -24,7 +24,6 @@ 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 {
@@ -33,7 +32,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: ActorCellMetrics, system: ActorSystem, ref: ActorRef, props: Props, dispatcher: MessageDispatcher, parent: ActorRef): Unit = {
+ def afterCreation(cell: ActorCell, 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]
@@ -92,11 +91,13 @@ class BehaviourInvokeTracing {
}
@Pointcut("execution(* akka.actor.ActorCell.handleInvokeFailure(..)) && this(cell)")
- def actorInvokeFailure(cell: ActorCellMetrics): Unit = {}
+ def actorInvokeFailure(cell: ActorCell): Unit = {}
@Before("actorInvokeFailure(cell)")
- def beforeInvokeFailure(cell: ActorCellMetrics): Unit = {
- cell.actorMetricsRecorder.map {
+ def beforeInvokeFailure(cell: ActorCell): Unit = {
+ val cellWithMetrics = cell.asInstanceOf[ActorCellMetrics]
+
+ cellWithMetrics.actorMetricsRecorder.map {
am ⇒ am.errorCounter.record(1L)
}
}
diff --git a/kamon-core/src/main/scala/kamon/metrics/instruments/CounterRecorder.scala b/kamon-core/src/main/scala/kamon/metrics/instruments/CounterRecorder.scala
index 1ab743d2..0fd56105 100644
--- a/kamon-core/src/main/scala/kamon/metrics/instruments/CounterRecorder.scala
+++ b/kamon-core/src/main/scala/kamon/metrics/instruments/CounterRecorder.scala
@@ -23,7 +23,9 @@ import jsr166e.LongAdder
class CounterRecorder extends MetricRecorder {
private val counter = new LongAdder
- def record(value: Long): Unit = counter.add(value)
+ def record(value: Long): Unit = {
+ counter.add(value)
+ }
def collect(): MetricSnapshotLike = {
val sum = counter.sumThenReset()