From a2840a7020df81056a656d3e88be223f7af62ac6 Mon Sep 17 00:00:00 2001 From: Ivan Topolnjak Date: Wed, 22 Apr 2015 01:59:46 +0200 Subject: = akka: correctly handle invoke errors while processing system messages, fixes #184. --- .../kamon/akka/instrumentation/ActorCellInstrumentation.scala | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'kamon-akka/src') diff --git a/kamon-akka/src/main/scala/kamon/akka/instrumentation/ActorCellInstrumentation.scala b/kamon-akka/src/main/scala/kamon/akka/instrumentation/ActorCellInstrumentation.scala index deb43499..bfcc0ed0 100644 --- a/kamon-akka/src/main/scala/kamon/akka/instrumentation/ActorCellInstrumentation.scala +++ b/kamon-akka/src/main/scala/kamon/akka/instrumentation/ActorCellInstrumentation.scala @@ -117,7 +117,12 @@ class ActorCellInstrumentation { // In case that this actor is behind a router, count the errors for the router as well. val envelope = cell.currentMessage.asInstanceOf[RouterAwareEnvelope] - envelope.routerMetricsRecorder.map(_.errors.increment()) + if (envelope ne null) { + // The ActorCell.handleInvokeFailure(..) method is also called when a failure occurs + // while processing a system message, in which case ActorCell.currentMessage is always + // null. + envelope.routerMetricsRecorder.map(_.errors.increment()) + } } } -- cgit v1.2.3