aboutsummaryrefslogtreecommitdiff
path: root/kamon-trace/src/main
diff options
context:
space:
mode:
authorIvan Topolnak <itopolnak@despegar.com>2014-01-02 18:09:53 -0300
committerIvan Topolnak <itopolnak@despegar.com>2014-01-13 17:37:20 -0300
commit7a10c0ef2a6566229e8571f6d385ca2ff794cc20 (patch)
treececd7ce6eb7a71f967eaa1605615780fa94d346c /kamon-trace/src/main
parent54143e4af6182b967736abc60a7fb20c88dd6587 (diff)
downloadKamon-7a10c0ef2a6566229e8571f6d385ca2ff794cc20.tar.gz
Kamon-7a10c0ef2a6566229e8571f6d385ca2ff794cc20.tar.bz2
Kamon-7a10c0ef2a6566229e8571f6d385ca2ff794cc20.zip
integrate trace and metrics into the base project
Diffstat (limited to 'kamon-trace/src/main')
-rw-r--r--kamon-trace/src/main/resources/META-INF/aop.xml26
-rw-r--r--kamon-trace/src/main/resources/reference.conf3
-rw-r--r--kamon-trace/src/main/scala/akka/actor/ActorSystemMessagePassingTracing.scala65
-rw-r--r--kamon-trace/src/main/scala/akka/pattern/AskPatternTracing.scala48
-rw-r--r--kamon-trace/src/main/scala/kamon/trace/Segments.scala38
-rw-r--r--kamon-trace/src/main/scala/kamon/trace/Trace.scala114
-rw-r--r--kamon-trace/src/main/scala/kamon/trace/TraceContext.scala49
-rw-r--r--kamon-trace/src/main/scala/kamon/trace/UowTracing.scala82
-rw-r--r--kamon-trace/src/main/scala/kamon/trace/instrumentation/ActorLoggingTracing.scala37
-rw-r--r--kamon-trace/src/main/scala/kamon/trace/instrumentation/ActorMessagePassingTracing.scala59
-rw-r--r--kamon-trace/src/main/scala/kamon/trace/instrumentation/FutureTracing.scala47
-rw-r--r--kamon-trace/src/main/scala/kamon/trace/logging/LogbackUowConverter.scala24
12 files changed, 0 insertions, 592 deletions
diff --git a/kamon-trace/src/main/resources/META-INF/aop.xml b/kamon-trace/src/main/resources/META-INF/aop.xml
deleted file mode 100644
index d9916724..00000000
--- a/kamon-trace/src/main/resources/META-INF/aop.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-<!DOCTYPE aspectj PUBLIC "-//AspectJ//DTD//EN" "http://www.eclipse.org/aspectj/dtd/aspectj.dtd">
-
-<aspectj>
- <aspects>
- <!-- Actors -->
- <aspect name="akka.actor.RepointableActorRefTraceContextMixin"/>
- <aspect name="akka.actor.SystemMessageTraceContextMixin"/>
- <aspect name="akka.actor.ActorSystemMessagePassingTracing"/>
- <aspect name="kamon.trace.instrumentation.EnvelopeTraceContextMixin"/>
- <aspect name="kamon.trace.instrumentation.BehaviourInvokeTracing"/>
- <aspect name="kamon.trace.instrumentation.ActorLoggingTracing"/>
-
- <!-- Futures -->
- <aspect name="kamon.trace.instrumentation.FutureTracing"/>
-
- <!-- Patterns -->
- <aspect name="akka.pattern.AskPatternTracing"/>
-
-
- <include within="scala.concurrent..*"/>
- <include within="akka..*"/>
- <include within="spray..*"/>
- <include within="kamon..*"/>
- </aspects>
-
-</aspectj>
diff --git a/kamon-trace/src/main/resources/reference.conf b/kamon-trace/src/main/resources/reference.conf
deleted file mode 100644
index 03f13f01..00000000
--- a/kamon-trace/src/main/resources/reference.conf
+++ /dev/null
@@ -1,3 +0,0 @@
-kamon.trace {
- ask-pattern-tracing = off
-} \ No newline at end of file
diff --git a/kamon-trace/src/main/scala/akka/actor/ActorSystemMessagePassingTracing.scala b/kamon-trace/src/main/scala/akka/actor/ActorSystemMessagePassingTracing.scala
deleted file mode 100644
index 6a82782c..00000000
--- a/kamon-trace/src/main/scala/akka/actor/ActorSystemMessagePassingTracing.scala
+++ /dev/null
@@ -1,65 +0,0 @@
-package akka.actor
-
-import org.aspectj.lang.annotation._
-import kamon.trace.{ Trace, ContextAware }
-import akka.dispatch.sysmsg.EarliestFirstSystemMessageList
-import org.aspectj.lang.ProceedingJoinPoint
-
-@Aspect
-class SystemMessageTraceContextMixin {
-
- @DeclareMixin("akka.dispatch.sysmsg.SystemMessage+")
- def mixin: ContextAware = ContextAware.default
-
- @Pointcut("execution(akka.dispatch.sysmsg.SystemMessage+.new(..)) && this(ctx)")
- def envelopeCreation(ctx: ContextAware): Unit = {}
-
- @After("envelopeCreation(ctx)")
- def afterEnvelopeCreation(ctx: ContextAware): Unit = {
- // Necessary to force the initialization of ContextAware at the moment of creation.
- ctx.traceContext
- }
-}
-
-@Aspect
-class RepointableActorRefTraceContextMixin {
-
- @DeclareMixin("akka.actor.RepointableActorRef")
- def mixin: ContextAware = ContextAware.default
-
- @Pointcut("execution(akka.actor.RepointableActorRef.new(..)) && this(ctx)")
- def envelopeCreation(ctx: ContextAware): Unit = {}
-
- @After("envelopeCreation(ctx)")
- def afterEnvelopeCreation(ctx: ContextAware): Unit = {
- // Necessary to force the initialization of ContextAware at the moment of creation.
- ctx.traceContext
- }
-
- @Pointcut("execution(* akka.actor.RepointableActorRef.point(..)) && this(repointableActorRef)")
- def repointableActorRefCreation(repointableActorRef: ContextAware): Unit = {}
-
- @Around("repointableActorRefCreation(repointableActorRef)")
- def afterRepointableActorRefCreation(pjp: ProceedingJoinPoint, repointableActorRef: ContextAware): Any = {
- Trace.withContext(repointableActorRef.traceContext) {
- pjp.proceed()
- }
- }
-
-}
-
-@Aspect
-class ActorSystemMessagePassingTracing {
-
- @Pointcut("execution(* akka.actor.ActorCell.invokeAll$1(..)) && args(messages, *)")
- def systemMessageProcessing(messages: EarliestFirstSystemMessageList): Unit = {}
-
- @Around("systemMessageProcessing(messages)")
- def aroundSystemMessageInvoke(pjp: ProceedingJoinPoint, messages: EarliestFirstSystemMessageList): Any = {
- if (messages.nonEmpty) {
- val ctx = messages.head.asInstanceOf[ContextAware].traceContext
- Trace.withContext(ctx)(pjp.proceed())
-
- } else pjp.proceed()
- }
-}
diff --git a/kamon-trace/src/main/scala/akka/pattern/AskPatternTracing.scala b/kamon-trace/src/main/scala/akka/pattern/AskPatternTracing.scala
deleted file mode 100644
index 970a4a51..00000000
--- a/kamon-trace/src/main/scala/akka/pattern/AskPatternTracing.scala
+++ /dev/null
@@ -1,48 +0,0 @@
-/* ===================================================
- * Copyright © 2013 the kamon project <http://kamon.io/>
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ========================================================== */
-package akka.pattern
-
-import org.aspectj.lang.annotation.{ AfterReturning, Pointcut, Aspect }
-import akka.event.Logging.Warning
-import scala.compat.Platform.EOL
-import akka.actor.ActorRefProvider
-
-@Aspect
-class AskPatternTracing {
-
- class StackTraceCaptureException extends Throwable
-
- @Pointcut(value = "execution(* akka.pattern.PromiseActorRef$.apply(..)) && args(provider, *)", argNames = "provider")
- def promiseActorRefApply(provider: ActorRefProvider): Unit = {
- provider.settings.config.getBoolean("kamon.trace.ask-pattern-tracing")
- }
-
- @AfterReturning(pointcut = "promiseActorRefApply(provider)", returning = "promiseActor")
- def hookAskTimeoutWarning(provider: ActorRefProvider, promiseActor: PromiseActorRef): Unit = {
- val future = promiseActor.result.future
- val system = promiseActor.provider.guardian.underlying.system
- implicit val ec = system.dispatcher
- val stack = new StackTraceCaptureException
-
- future onFailure {
- case timeout: AskTimeoutException ⇒
- val stackString = stack.getStackTrace.drop(3).mkString("", EOL, EOL)
-
- system.eventStream.publish(Warning("AskPatternTracing", classOf[AskPatternTracing],
- "Timeout triggered for ask pattern registered at: " + stackString))
- }
- }
-}
diff --git a/kamon-trace/src/main/scala/kamon/trace/Segments.scala b/kamon-trace/src/main/scala/kamon/trace/Segments.scala
deleted file mode 100644
index 0bc68ee7..00000000
--- a/kamon-trace/src/main/scala/kamon/trace/Segments.scala
+++ /dev/null
@@ -1,38 +0,0 @@
-/* ===================================================
- * Copyright © 2013 the kamon project <http://kamon.io/>
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ========================================================== */
-
-package kamon.trace
-
-import kamon.trace.Trace.SegmentCompletionHandle
-
-object Segments {
-
- trait Category
- case object HttpClientRequest extends Category
-
- case class Start(category: Category, description: String = "",
- attributes: Map[String, String] = Map(), timestamp: Long = System.nanoTime())
-
- case class End(attributes: Map[String, String] = Map(), timestamp: Long = System.nanoTime())
-
- case class Segment(start: Start, end: End)
-
- trait SegmentCompletionHandleAware {
- var completionHandle: Option[SegmentCompletionHandle]
- }
-
- trait ContextAndSegmentCompletionAware extends ContextAware with SegmentCompletionHandleAware
-}
diff --git a/kamon-trace/src/main/scala/kamon/trace/Trace.scala b/kamon-trace/src/main/scala/kamon/trace/Trace.scala
deleted file mode 100644
index 0985f547..00000000
--- a/kamon-trace/src/main/scala/kamon/trace/Trace.scala
+++ /dev/null
@@ -1,114 +0,0 @@
-/* ===================================================
- * Copyright © 2013 the kamon project <http://kamon.io/>
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ========================================================== */
-package kamon.trace
-
-import kamon.Kamon
-import akka.actor._
-import scala.Some
-import kamon.trace.Trace.Register
-import scala.concurrent.duration._
-import java.util.concurrent.atomic.AtomicLong
-
-object Trace extends ExtensionId[TraceExtension] with ExtensionIdProvider {
- def lookup(): ExtensionId[_ <: Extension] = Trace
- def createExtension(system: ExtendedActorSystem): TraceExtension = new TraceExtension(system)
-
- /*** Protocol */
- case object Register
-
- /** User API */
- //private[trace] val traceContext = new DynamicVariable[Option[TraceContext]](None)
- private[trace] val traceContext = new ThreadLocal[Option[TraceContext]] {
- override def initialValue(): Option[TraceContext] = None
- }
- private[trace] val tranid = new AtomicLong()
-
- def context() = traceContext.get
- private def set(ctx: Option[TraceContext]) = traceContext.set(ctx)
-
- def clear: Unit = traceContext.remove()
- def start(name: String)(implicit system: ActorSystem): TraceContext = {
- val ctx = newTraceContext(name)
- ctx.start(name)
- set(Some(ctx))
-
- ctx
- }
-
- def withContext[T](ctx: Option[TraceContext])(thunk: ⇒ T): T = {
- val oldval = context
- set(ctx)
-
- try thunk
- finally set(oldval)
- }
-
- def transformContext(f: TraceContext ⇒ TraceContext): Unit = {
- context.map(f).foreach(ctx ⇒ set(Some(ctx)))
- }
-
- def finish(): Option[TraceContext] = {
- val ctx = context()
- ctx.map(_.finish)
- clear
- ctx
- }
-
- // TODO: FIX
- def newTraceContext(name: String)(implicit system: ActorSystem): TraceContext = TraceContext(Kamon(Trace), tranid.getAndIncrement, name)
-
- def startSegment(category: Segments.Category, description: String = "", attributes: Map[String, String] = Map()): SegmentCompletionHandle = {
- val start = Segments.Start(category, description, attributes)
- SegmentCompletionHandle(start)
- }
-
- def startSegment(start: Segments.Start): SegmentCompletionHandle = SegmentCompletionHandle(start)
-
- case class SegmentCompletionHandle(start: Segments.Start) {
- def complete(): Unit = {
- val end = Segments.End()
- println(s"Completing the Segment: $start - $end")
- }
- def complete(end: Segments.End): Unit = {
- println(s"Completing the Segment: $start - $end")
- }
- }
-}
-
-class TraceExtension(system: ExtendedActorSystem) extends Kamon.Extension {
- val manager: ActorRef = system.actorOf(Props[TraceManager], "kamon-trace")
-}
-
-class TraceManager extends Actor with ActorLogging {
- var listeners: Seq[ActorRef] = Seq.empty
-
- def receive = {
- case Register ⇒
- listeners = sender +: listeners
- log.info("Registered [{}] as listener for Kamon traces", sender)
-
- case segment: UowSegment ⇒
- val tracerName = segment.id.toString
- context.child(tracerName).getOrElse(newTracer(tracerName)) ! segment
-
- case trace: UowTrace ⇒
- listeners foreach (_ ! trace)
- }
-
- def newTracer(name: String): ActorRef = {
- context.actorOf(UowTraceAggregator.props(self, 30 seconds), name)
- }
-}
diff --git a/kamon-trace/src/main/scala/kamon/trace/TraceContext.scala b/kamon-trace/src/main/scala/kamon/trace/TraceContext.scala
deleted file mode 100644
index 3698cea1..00000000
--- a/kamon-trace/src/main/scala/kamon/trace/TraceContext.scala
+++ /dev/null
@@ -1,49 +0,0 @@
-/* ===================================================
- * Copyright © 2013 the kamon project <http://kamon.io/>
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ========================================================== */
-package kamon.trace
-
-import java.util.UUID
-import akka.actor._
-import java.util.concurrent.atomic.AtomicLong
-import scala.concurrent.duration._
-import kamon.Kamon
-import kamon.trace.UowTracing.{ Finish, Start }
-
-// TODO: Decide if we need or not an ID, generating it takes time and it doesn't seem necessary.
-case class TraceContext(private val collector: ActorRef, id: Long, uow: String = "", userContext: Option[Any] = None) {
-
- def start(name: String) = collector ! Start(id, name)
-
- def finish: Unit = {
- collector ! Finish(id)
- }
-
-}
-
-trait ContextAware {
- def traceContext: Option[TraceContext]
-}
-
-object ContextAware {
- def default: ContextAware = new ContextAware {
- val traceContext: Option[TraceContext] = Trace.context()
- }
-}
-
-trait TimedContextAware {
- def timestamp: Long
- def traceContext: Option[TraceContext]
-}
diff --git a/kamon-trace/src/main/scala/kamon/trace/UowTracing.scala b/kamon-trace/src/main/scala/kamon/trace/UowTracing.scala
deleted file mode 100644
index 20cce830..00000000
--- a/kamon-trace/src/main/scala/kamon/trace/UowTracing.scala
+++ /dev/null
@@ -1,82 +0,0 @@
-/* ===================================================
- * Copyright © 2013 the kamon project <http://kamon.io/>
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ========================================================== */
-package kamon.trace
-
-import akka.actor._
-import scala.concurrent.duration.Duration
-import kamon.trace.UowTracing._
-
-sealed trait UowSegment {
- def id: Long
- def timestamp: Long
-}
-
-trait AutoTimestamp extends UowSegment {
- val timestamp = System.nanoTime
-}
-
-object UowTracing {
- case class Start(id: Long, name: String) extends AutoTimestamp
- case class Finish(id: Long) extends AutoTimestamp
- case class Rename(id: Long, name: String) extends AutoTimestamp
- case class WebExternalStart(id: Long, host: String) extends AutoTimestamp
- case class WebExternalFinish(id: Long) extends AutoTimestamp
- case class WebExternal(id: Long, start: Long, finish: Long, host: String) extends AutoTimestamp
-}
-
-case class UowTrace(name: String, uow: String, start: Long, end: Long, segments: Seq[UowSegment]) {
- def elapsed: Long = end - start
-}
-
-class UowTraceAggregator(reporting: ActorRef, aggregationTimeout: Duration) extends Actor with ActorLogging {
- context.setReceiveTimeout(aggregationTimeout)
-
- var name: String = "UNKNOWN"
- var segments: Seq[UowSegment] = Nil
-
- var pendingExternal = List[WebExternalStart]()
-
- var start = 0L
- var end = 0L
-
- def receive = {
- case start: Start ⇒
- this.start = start.timestamp
- segments = segments :+ start
- name = start.name
- case finish: Finish ⇒
- end = finish.timestamp
- segments = segments :+ finish; finishTracing()
- case wes: WebExternalStart ⇒ pendingExternal = pendingExternal :+ wes
- case finish @ WebExternalFinish(id) ⇒ pendingExternal.find(_.id == id).map(start ⇒ {
- segments = segments :+ WebExternal(finish.id, start.timestamp, finish.timestamp, start.host)
- })
- case Rename(id, newName) ⇒ name = newName
- case segment: UowSegment ⇒ segments = segments :+ segment
- case ReceiveTimeout ⇒
- log.warning("Transaction {} did not complete properly, the recorded segments are: {}", name, segments)
- context.stop(self)
- }
-
- def finishTracing(): Unit = {
- reporting ! UowTrace(name, "", start, end, segments)
- context.stop(self)
- }
-}
-
-object UowTraceAggregator {
- def props(reporting: ActorRef, aggregationTimeout: Duration) = Props(classOf[UowTraceAggregator], reporting, aggregationTimeout)
-}
diff --git a/kamon-trace/src/main/scala/kamon/trace/instrumentation/ActorLoggingTracing.scala b/kamon-trace/src/main/scala/kamon/trace/instrumentation/ActorLoggingTracing.scala
deleted file mode 100644
index 0d06eb2c..00000000
--- a/kamon-trace/src/main/scala/kamon/trace/instrumentation/ActorLoggingTracing.scala
+++ /dev/null
@@ -1,37 +0,0 @@
-/* ===================================================
- * Copyright © 2013 the kamon project <http://kamon.io/>
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ========================================================== */
-package kamon.trace.instrumentation
-
-import org.aspectj.lang.annotation.{ Around, Pointcut, DeclareMixin, Aspect }
-import org.aspectj.lang.ProceedingJoinPoint
-import kamon.trace.{ ContextAware, Trace }
-
-@Aspect
-class ActorLoggingTracing {
-
- @DeclareMixin("akka.event.Logging.LogEvent+")
- def mixin: ContextAware = ContextAware.default
-
- @Pointcut("execution(* akka.event.slf4j.Slf4jLogger.withMdc(..)) && args(logSource, logEvent, logStatement)")
- def withMdcInvocation(logSource: String, logEvent: ContextAware, logStatement: () ⇒ _): Unit = {}
-
- @Around("withMdcInvocation(logSource, logEvent, logStatement)")
- def aroundWithMdcInvocation(pjp: ProceedingJoinPoint, logSource: String, logEvent: ContextAware, logStatement: () ⇒ _): Unit = {
- Trace.withContext(logEvent.traceContext) {
- pjp.proceed()
- }
- }
-}
diff --git a/kamon-trace/src/main/scala/kamon/trace/instrumentation/ActorMessagePassingTracing.scala b/kamon-trace/src/main/scala/kamon/trace/instrumentation/ActorMessagePassingTracing.scala
deleted file mode 100644
index 399ddf61..00000000
--- a/kamon-trace/src/main/scala/kamon/trace/instrumentation/ActorMessagePassingTracing.scala
+++ /dev/null
@@ -1,59 +0,0 @@
-/* ===================================================
- * Copyright © 2013 the kamon project <http://kamon.io/>
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ========================================================== */
-package kamon.trace.instrumentation
-
-import org.aspectj.lang.annotation._
-import org.aspectj.lang.ProceedingJoinPoint
-import akka.actor.{ Props, ActorSystem, ActorRef }
-import akka.dispatch.{ Envelope, MessageDispatcher }
-import com.codahale.metrics.Timer
-import kamon.trace.{ ContextAware, TraceContext, Trace }
-
-@Aspect
-class BehaviourInvokeTracing {
-
- @Pointcut("execution(akka.actor.ActorCell.new(..)) && args(system, ref, props, dispatcher, parent)")
- def actorCellCreation(system: ActorSystem, ref: ActorRef, props: Props, dispatcher: MessageDispatcher, parent: ActorRef): Unit = {}
-
- @Pointcut("(execution(* akka.actor.ActorCell.invoke(*)) || execution(* akka.routing.RoutedActorCell.sendMessage(*))) && args(envelope)")
- def invokingActorBehaviourAtActorCell(envelope: Envelope) = {}
-
- @Around("invokingActorBehaviourAtActorCell(envelope)")
- def aroundBehaviourInvoke(pjp: ProceedingJoinPoint, envelope: Envelope): Unit = {
- //safe cast
- val ctxInMessage = envelope.asInstanceOf[ContextAware].traceContext
-
- Trace.withContext(ctxInMessage) {
- pjp.proceed()
- }
- }
-}
-
-@Aspect
-class EnvelopeTraceContextMixin {
-
- @DeclareMixin("akka.dispatch.Envelope")
- def mixin: ContextAware = ContextAware.default
-
- @Pointcut("execution(akka.dispatch.Envelope.new(..)) && this(ctx)")
- def envelopeCreation(ctx: ContextAware): Unit = {}
-
- @After("envelopeCreation(ctx)")
- def afterEnvelopeCreation(ctx: ContextAware): Unit = {
- // Necessary to force the initialization of ContextAware at the moment of creation.
- ctx.traceContext
- }
-}
diff --git a/kamon-trace/src/main/scala/kamon/trace/instrumentation/FutureTracing.scala b/kamon-trace/src/main/scala/kamon/trace/instrumentation/FutureTracing.scala
deleted file mode 100644
index 844f1d61..00000000
--- a/kamon-trace/src/main/scala/kamon/trace/instrumentation/FutureTracing.scala
+++ /dev/null
@@ -1,47 +0,0 @@
-/* ===================================================
- * Copyright © 2013 the kamon project <http://kamon.io/>
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ========================================================== */
-package kamon.trace.instrumentation
-
-import org.aspectj.lang.annotation._
-import org.aspectj.lang.ProceedingJoinPoint
-import kamon.trace.{ ContextAware, TraceContext, Trace }
-
-@Aspect
-class FutureTracing {
-
- @DeclareMixin("scala.concurrent.impl.CallbackRunnable || scala.concurrent.impl.Future.PromiseCompletingRunnable")
- def mixin: ContextAware = ContextAware.default
-
- @Pointcut("execution((scala.concurrent.impl.CallbackRunnable || scala.concurrent.impl.Future.PromiseCompletingRunnable).new(..)) && this(runnable)")
- def futureRelatedRunnableCreation(runnable: ContextAware): Unit = {}
-
- @After("futureRelatedRunnableCreation(runnable)")
- def afterCreation(runnable: ContextAware): Unit = {
- // Force traceContext initialization.
- runnable.traceContext
- }
-
- @Pointcut("execution(* (scala.concurrent.impl.CallbackRunnable || scala.concurrent.impl.Future.PromiseCompletingRunnable).run()) && this(runnable)")
- def futureRelatedRunnableExecution(runnable: ContextAware) = {}
-
- @Around("futureRelatedRunnableExecution(runnable)")
- def aroundExecution(pjp: ProceedingJoinPoint, runnable: ContextAware): Any = {
- Trace.withContext(runnable.traceContext) {
- pjp.proceed()
- }
- }
-
-} \ No newline at end of file
diff --git a/kamon-trace/src/main/scala/kamon/trace/logging/LogbackUowConverter.scala b/kamon-trace/src/main/scala/kamon/trace/logging/LogbackUowConverter.scala
deleted file mode 100644
index add47fdf..00000000
--- a/kamon-trace/src/main/scala/kamon/trace/logging/LogbackUowConverter.scala
+++ /dev/null
@@ -1,24 +0,0 @@
-/* ===================================================
- * Copyright © 2013 the kamon project <http://kamon.io/>
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ========================================================== */
-package kamon.trace.logging
-
-import ch.qos.logback.classic.pattern.ClassicConverter
-import ch.qos.logback.classic.spi.ILoggingEvent
-import kamon.trace.Trace
-
-class LogbackUowConverter extends ClassicConverter {
- def convert(event: ILoggingEvent): String = Trace.context().map(_.uow).getOrElse("undefined")
-}