diff options
author | Ivan Topolnjak <ivantopo@gmail.com> | 2015-02-15 11:16:21 +0100 |
---|---|---|
committer | Ivan Topolnjak <ivantopo@gmail.com> | 2015-02-15 11:16:21 +0100 |
commit | cd300053cfec39dc75c1ea47b08ab5c78fe3f4bb (patch) | |
tree | 0f07e794e6fb88e180913a10f57ffaa4e2fa03cc /kamon-akka/src/main/scala/kamon | |
parent | 8a532fc8c95a5700721248b6b4f558d9a1dcebcb (diff) | |
download | Kamon-cd300053cfec39dc75c1ea47b08ab5c78fe3f4bb.tar.gz Kamon-cd300053cfec39dc75c1ea47b08ab5c78fe3f4bb.tar.bz2 Kamon-cd300053cfec39dc75c1ea47b08ab5c78fe3f4bb.zip |
! core: move the TraceContext manipulation API to the Tracer companion object.
Diffstat (limited to 'kamon-akka/src/main/scala/kamon')
4 files changed, 10 insertions, 11 deletions
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 7c722569..4783484f 100644 --- a/kamon-akka/src/main/scala/kamon/akka/instrumentation/ActorCellInstrumentation.scala +++ b/kamon-akka/src/main/scala/kamon/akka/instrumentation/ActorCellInstrumentation.scala @@ -53,7 +53,7 @@ class ActorCellInstrumentation { val contextAndTimestamp = envelope.asInstanceOf[TimestampedTraceContextAware] try { - TraceContext.withContext(contextAndTimestamp.traceContext) { + Tracer.withContext(contextAndTimestamp.traceContext) { pjp.proceed() } } finally { @@ -142,7 +142,7 @@ class RoutedActorCellInstrumentation { val contextAndTimestamp = envelope.asInstanceOf[TimestampedTraceContextAware] try { - TraceContext.withContext(contextAndTimestamp.traceContext) { + Tracer.withContext(contextAndTimestamp.traceContext) { // The router metrics recorder will only be picked up if the message is sent from a tracked router. RouterAwareEnvelope.dynamicRouterMetricsRecorder.withValue(cellMetrics.routerRecorder) { diff --git a/kamon-akka/src/main/scala/kamon/akka/instrumentation/ActorLoggingInstrumentation.scala b/kamon-akka/src/main/scala/kamon/akka/instrumentation/ActorLoggingInstrumentation.scala index dd998c6b..f17c4976 100644 --- a/kamon-akka/src/main/scala/kamon/akka/instrumentation/ActorLoggingInstrumentation.scala +++ b/kamon-akka/src/main/scala/kamon/akka/instrumentation/ActorLoggingInstrumentation.scala @@ -17,7 +17,7 @@ package akka.kamon.instrumentation import kamon.trace.logging.MdcKeysSupport -import kamon.trace.{ TraceContext, TraceContextAware } +import kamon.trace.{ Tracer, TraceContextAware } import org.aspectj.lang.ProceedingJoinPoint import org.aspectj.lang.annotation._ @@ -41,7 +41,7 @@ class ActorLoggingInstrumentation extends MdcKeysSupport { @Around("withMdcInvocation(logSource, logEvent, logStatement)") def aroundWithMdcInvocation(pjp: ProceedingJoinPoint, logSource: String, logEvent: TraceContextAware, logStatement: () ⇒ _): Unit = { - TraceContext.withContext(logEvent.traceContext) { + Tracer.withContext(logEvent.traceContext) { withMdc { pjp.proceed() } diff --git a/kamon-akka/src/main/scala/kamon/akka/instrumentation/ActorSystemMessageInstrumentation.scala b/kamon-akka/src/main/scala/kamon/akka/instrumentation/ActorSystemMessageInstrumentation.scala index 0cb4ef13..c123ee04 100644 --- a/kamon-akka/src/main/scala/kamon/akka/instrumentation/ActorSystemMessageInstrumentation.scala +++ b/kamon-akka/src/main/scala/kamon/akka/instrumentation/ActorSystemMessageInstrumentation.scala @@ -17,7 +17,7 @@ package akka.kamon.instrumentation import akka.dispatch.sysmsg.EarliestFirstSystemMessageList -import kamon.trace.{ TraceContext, TraceContextAware } +import kamon.trace.{ Tracer, TraceContextAware } import org.aspectj.lang.ProceedingJoinPoint import org.aspectj.lang.annotation._ @@ -31,7 +31,7 @@ class ActorSystemMessageInstrumentation { def aroundSystemMessageInvoke(pjp: ProceedingJoinPoint, messages: EarliestFirstSystemMessageList): Any = { if (messages.nonEmpty) { val ctx = messages.head.asInstanceOf[TraceContextAware].traceContext - TraceContext.withContext(ctx)(pjp.proceed()) + Tracer.withContext(ctx)(pjp.proceed()) } else pjp.proceed() } @@ -73,7 +73,7 @@ class TraceContextIntoRepointableActorRefMixin { @Around("repointableActorRefCreation(repointableActorRef)") def afterRepointableActorRefCreation(pjp: ProceedingJoinPoint, repointableActorRef: TraceContextAware): Any = { - TraceContext.withContext(repointableActorRef.traceContext) { + Tracer.withContext(repointableActorRef.traceContext) { pjp.proceed() } } diff --git a/kamon-akka/src/main/scala/kamon/akka/instrumentation/AskPatternInstrumentation.scala b/kamon-akka/src/main/scala/kamon/akka/instrumentation/AskPatternInstrumentation.scala index e1dcdf32..42edf4db 100644 --- a/kamon-akka/src/main/scala/kamon/akka/instrumentation/AskPatternInstrumentation.scala +++ b/kamon-akka/src/main/scala/kamon/akka/instrumentation/AskPatternInstrumentation.scala @@ -19,16 +19,15 @@ package akka.kamon.instrumentation import akka.util.Timeout import kamon.Kamon import kamon.akka.Akka -import kamon.trace.{ TraceContext, EmptyTraceContext, TraceContextAware } +import kamon.trace.Tracer import akka.actor.{ InternalActorRef, ActorSystem, ActorRef } import akka.event.Logging.Warning -import akka.pattern.{ PromiseActorRef, AskTimeoutException } +import akka.pattern.AskTimeoutException import org.aspectj.lang.ProceedingJoinPoint import org.aspectj.lang.annotation._ import org.aspectj.lang.reflect.SourceLocation import scala.concurrent.Future import scala.compat.Platform.EOL -import scala.concurrent.duration.FiniteDuration @Aspect class AskPatternInstrumentation { @@ -40,7 +39,7 @@ class AskPatternInstrumentation { @Around("askableActorRefAsk(actor, timeout)") def hookAskTimeoutWarning(pjp: ProceedingJoinPoint, actor: ActorRef, timeout: Timeout): AnyRef = - TraceContext.map { ctx ⇒ + Tracer.currentContext.collect { ctx ⇒ actor match { // the AskPattern will only work for InternalActorRef's with these conditions. case ref: InternalActorRef if !ref.isTerminated && timeout.duration.length > 0 ⇒ |