diff options
author | Diego <diegolparra@gmail.com> | 2014-05-09 18:23:21 -0300 |
---|---|---|
committer | Diego <diegolparra@gmail.com> | 2014-05-09 18:23:21 -0300 |
commit | 0ce3f4c0e8eb7dfd4aadd8300880e001a9a9bb8d (patch) | |
tree | f4f08e425ddb7261ddd34d69e78315292e7cbdda /kamon-play/src/main/scala/kamon/play | |
parent | e7d18421c354d4dbc3c5b77073fb0b195eb45cfe (diff) | |
download | Kamon-0ce3f4c0e8eb7dfd4aadd8300880e001a9a9bb8d.tar.gz Kamon-0ce3f4c0e8eb7dfd4aadd8300880e001a9a9bb8d.tar.bz2 Kamon-0ce3f4c0e8eb7dfd4aadd8300880e001a9a9bb8d.zip |
+ play: removed default dispatchers to kamon default dispatcher and refactor test in WSInstrumentationSpec
Diffstat (limited to 'kamon-play/src/main/scala/kamon/play')
3 files changed, 7 insertions, 4 deletions
diff --git a/kamon-play/src/main/scala/kamon/play/Play.scala b/kamon-play/src/main/scala/kamon/play/Play.scala index d52de450..d29c5666 100644 --- a/kamon-play/src/main/scala/kamon/play/Play.scala +++ b/kamon-play/src/main/scala/kamon/play/Play.scala @@ -18,6 +18,7 @@ package kamon.play import akka.actor.{ ExtendedActorSystem, Extension, ExtensionIdProvider, ExtensionId } import kamon.Kamon +import kamon.util.Contexts object Play extends ExtensionId[PlayExtension] with ExtensionIdProvider { override def lookup(): ExtensionId[_ <: Extension] = Play @@ -29,6 +30,7 @@ class PlayExtension(private val system: ExtendedActorSystem) extends Kamon.Exten private val config = system.settings.config.getConfig("kamon.play") + val defaultDispatcher = Contexts.lookupExecutionContext(Contexts.kamonDefaultDispatcher)(system) val includeTraceToken: Boolean = config.getBoolean("include-trace-token-header") val traceTokenHeaderName: String = config.getString("trace-token-header-name") } diff --git a/kamon-play/src/main/scala/kamon/play/instrumentation/RequestInstrumentation.scala b/kamon-play/src/main/scala/kamon/play/instrumentation/RequestInstrumentation.scala index e671d097..3a84f741 100644 --- a/kamon-play/src/main/scala/kamon/play/instrumentation/RequestInstrumentation.scala +++ b/kamon-play/src/main/scala/kamon/play/instrumentation/RequestInstrumentation.scala @@ -16,7 +16,6 @@ package kamon.play.instrumentation -import scala.concurrent.ExecutionContext.Implicits.global import kamon.trace.{ TraceRecorder, TraceContextAware } import kamon.Kamon import kamon.play.Play @@ -26,6 +25,7 @@ import akka.actor.ActorSystem import org.aspectj.lang.ProceedingJoinPoint import org.aspectj.lang.annotation._ import scala.Some +import kamon.util.Contexts @Aspect class RequestInstrumentation { @@ -63,9 +63,11 @@ class RequestInstrumentation { } private[this] val kamonRequestFilter = Filter { (nextFilter, requestHeader) ⇒ + processRequest(requestHeader) val incomingContext = TraceRecorder.currentContext + val executor = Kamon(Play)(Akka.system()).defaultDispatcher nextFilter(requestHeader).map { result ⇒ @@ -80,7 +82,7 @@ class RequestInstrumentation { } else result } simpleResult - } + }(executor) } private[this] def processRequest(requestHeader: RequestHeader): Unit = { diff --git a/kamon-play/src/main/scala/kamon/play/instrumentation/WSInstrumentation.scala b/kamon-play/src/main/scala/kamon/play/instrumentation/WSInstrumentation.scala index 421f7be2..0951d2c9 100644 --- a/kamon-play/src/main/scala/kamon/play/instrumentation/WSInstrumentation.scala +++ b/kamon-play/src/main/scala/kamon/play/instrumentation/WSInstrumentation.scala @@ -55,8 +55,7 @@ object WSInstrumentation { def basicRequestAttributes(request: WSRequest): Map[String, String] = { Map[String, String]( "host" -> request.header("host").getOrElse("Unknown"), - "path" -> request.method, - "method" -> request.method) + "path" -> request.method) } } |