diff options
Diffstat (limited to 'kamon-akka-remote')
3 files changed, 15 insertions, 14 deletions
diff --git a/kamon-akka-remote/src/main/resources/reference.conf b/kamon-akka-remote/src/main/resources/reference.conf index 7c6be896..1d805cad 100644 --- a/kamon-akka-remote/src/main/resources/reference.conf +++ b/kamon-akka-remote/src/main/resources/reference.conf @@ -6,7 +6,8 @@ kamon { modules { kamon-akka-remote { - auto-start = yes + // Nothing to auto-start here. + auto-start = no requires-aspectj = yes extension-id = none } diff --git a/kamon-akka-remote/src/main/scala/kamon/akka/instrumentation/RemotingInstrumentation.scala b/kamon-akka-remote/src/main/scala/kamon/akka/instrumentation/RemotingInstrumentation.scala index 2e4b8fc3..ccf30c7f 100644 --- a/kamon-akka-remote/src/main/scala/kamon/akka/instrumentation/RemotingInstrumentation.scala +++ b/kamon-akka-remote/src/main/scala/kamon/akka/instrumentation/RemotingInstrumentation.scala @@ -6,7 +6,7 @@ import akka.remote.{ RemoteActorRefProvider, Ack, SeqNo } import akka.remote.WireFormats._ import akka.util.ByteString import kamon.Kamon -import kamon.trace.TraceContext +import kamon.trace.{ Tracer, TraceContext } import kamon.util.MilliTimestamp import org.aspectj.lang.ProceedingJoinPoint import org.aspectj.lang.annotation._ @@ -33,7 +33,7 @@ class RemotingInstrumentation { envelopeBuilder.setMessage(serializedMessage) // Attach the TraceContext info, if available. - TraceContext.map { context ⇒ + Tracer.currentContext.collect { context ⇒ envelopeBuilder.setTraceContext(RemoteTraceContext.newBuilder() .setTraceName(context.name) @@ -87,12 +87,12 @@ class RemotingInstrumentation { val ctx = tracer.newContext( remoteTraceContext.getTraceName, - remoteTraceContext.getTraceToken, + Option(remoteTraceContext.getTraceToken), new MilliTimestamp(remoteTraceContext.getStartMilliTime()).toRelativeNanoTimestamp, remoteTraceContext.getIsOpen, isLocal = false) - TraceContext.setCurrentContext(ctx) + Tracer.setCurrentContext(ctx) } pjp.proceed() diff --git a/kamon-akka-remote/src/test/scala/kamon/akka/instrumentation/RemotingInstrumentationSpec.scala b/kamon-akka-remote/src/test/scala/kamon/akka/instrumentation/RemotingInstrumentationSpec.scala index e0aa90ac..6b1561d2 100644 --- a/kamon-akka-remote/src/test/scala/kamon/akka/instrumentation/RemotingInstrumentationSpec.scala +++ b/kamon-akka-remote/src/test/scala/kamon/akka/instrumentation/RemotingInstrumentationSpec.scala @@ -9,7 +9,7 @@ import akka.testkit.{ ImplicitSender, TestKitBase } import akka.util.Timeout import com.typesafe.config.ConfigFactory import kamon.Kamon -import kamon.trace.TraceContext +import kamon.trace.Tracer import org.scalatest.{ Matchers, WordSpecLike } import scala.concurrent.duration._ @@ -62,7 +62,7 @@ class RemotingInstrumentationSpec extends TestKitBase with WordSpecLike with Mat "The Remoting instrumentation" should { "propagate the TraceContext when creating a new remote actor" in { - TraceContext.withContext(tracer.newContext("deploy-remote-actor", "deploy-remote-actor-1")) { + Tracer.withContext(tracer.newContext("deploy-remote-actor", Some("deploy-remote-actor-1"))) { system.actorOf(TraceTokenReplier.remoteProps(Some(testActor), RemoteSystemAddress), "remote-deploy-fixture") } @@ -72,7 +72,7 @@ class RemotingInstrumentationSpec extends TestKitBase with WordSpecLike with Mat "propagate the TraceContext when sending a message to a remotely deployed actor" in { val remoteRef = system.actorOf(TraceTokenReplier.remoteProps(None, RemoteSystemAddress), "remote-message-fixture") - TraceContext.withContext(tracer.newContext("message-remote-actor", "message-remote-actor-1")) { + Tracer.withContext(tracer.newContext("message-remote-actor", Some("message-remote-actor-1"))) { remoteRef ! "reply-trace-token" } @@ -84,7 +84,7 @@ class RemotingInstrumentationSpec extends TestKitBase with WordSpecLike with Mat implicit val askTimeout = Timeout(10 seconds) val remoteRef = system.actorOf(TraceTokenReplier.remoteProps(None, RemoteSystemAddress), "remote-ask-and-pipe-fixture") - TraceContext.withContext(tracer.newContext("ask-and-pipe-remote-actor", "ask-and-pipe-remote-actor-1")) { + Tracer.withContext(tracer.newContext("ask-and-pipe-remote-actor", Some("ask-and-pipe-remote-actor-1"))) { (remoteRef ? "reply-trace-token") pipeTo (testActor) } @@ -96,7 +96,7 @@ class RemotingInstrumentationSpec extends TestKitBase with WordSpecLike with Mat remoteSystem.actorOf(TraceTokenReplier.props(None), "actor-selection-target-b") val selection = system.actorSelection(RemoteSystemAddress + "/user/actor-selection-target-*") - TraceContext.withContext(tracer.newContext("message-remote-actor-selection", "message-remote-actor-selection-1")) { + Tracer.withContext(tracer.newContext("message-remote-actor-selection", Some("message-remote-actor-selection-1"))) { selection ! "reply-trace-token" } @@ -108,7 +108,7 @@ class RemotingInstrumentationSpec extends TestKitBase with WordSpecLike with Mat "propagate the TraceContext if a remotely supervised child fails" in { val supervisor = system.actorOf(Props(new SupervisorOfRemote(testActor, RemoteSystemAddress))) - TraceContext.withContext(tracer.newContext("remote-supervision", "remote-supervision-1")) { + Tracer.withContext(tracer.newContext("remote-supervision", Some("remote-supervision-1"))) { supervisor ! "fail" } @@ -120,7 +120,7 @@ class RemotingInstrumentationSpec extends TestKitBase with WordSpecLike with Mat val routees = Vector[String](RemoteSystemAddress + "/user/remote-routee") val router = system.actorOf(Props.empty.withRouter(RoundRobinRouter(routees = routees))) - TraceContext.withContext(tracer.newContext("remote-routee", "remote-routee-1")) { + Tracer.withContext(tracer.newContext("remote-routee", Some("remote-routee-1"))) { router ! "reply-trace-token" } @@ -143,7 +143,7 @@ class TraceTokenReplier(creationTraceContextListener: Option[ActorRef]) extends } def currentTraceContextInfo: String = { - val ctx = TraceContext.currentContext + val ctx = Tracer.currentContext s"name=${ctx.name}|token=${ctx.token}|isOpen=${ctx.isOpen}" } } @@ -172,7 +172,7 @@ class SupervisorOfRemote(traceContextListener: ActorRef, remoteAddress: Address) } def currentTraceContextInfo: String = { - val ctx = TraceContext.currentContext + val ctx = Tracer.currentContext s"name=${ctx.name}|token=${ctx.token}|isOpen=${ctx.isOpen}" } } |