diff options
author | Diego <diegolparra@gmail.com> | 2014-09-15 22:35:37 -0300 |
---|---|---|
committer | Diego <diegolparra@gmail.com> | 2014-09-15 22:35:37 -0300 |
commit | f3aacf437193715405efbafdd8c12f5dcb1105e0 (patch) | |
tree | 0984e5321f7f2cb4af6480a21d0447cc3a5bed10 /kamon-play/src/main/scala/kamon/play/instrumentation/WSInstrumentation.scala | |
parent | 581b621d7e86106e367967811f9c1b8a7a5e63a0 (diff) | |
download | Kamon-f3aacf437193715405efbafdd8c12f5dcb1105e0.tar.gz Kamon-f3aacf437193715405efbafdd8c12f5dcb1105e0.tar.bz2 Kamon-f3aacf437193715405efbafdd8c12f5dcb1105e0.zip |
= play: fixes #84
Diffstat (limited to 'kamon-play/src/main/scala/kamon/play/instrumentation/WSInstrumentation.scala')
-rw-r--r-- | kamon-play/src/main/scala/kamon/play/instrumentation/WSInstrumentation.scala | 19 |
1 files changed, 7 insertions, 12 deletions
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 14bcd8c9..87467050 100644 --- a/kamon-play/src/main/scala/kamon/play/instrumentation/WSInstrumentation.scala +++ b/kamon-play/src/main/scala/kamon/play/instrumentation/WSInstrumentation.scala @@ -24,7 +24,6 @@ import org.aspectj.lang.ProceedingJoinPoint import org.aspectj.lang.annotation.{ Around, Aspect, Pointcut } import play.api.libs.ws.ning.NingWSRequest import play.api.libs.ws.{ WSRequest, WSResponse } -import play.libs.Akka import scala.concurrent.Future @@ -39,18 +38,14 @@ class WSInstrumentation { import kamon.play.instrumentation.WSInstrumentation._ - TraceRecorder.currentContext match { - case ctx @ Some(_) ⇒ - TraceRecorder.withTraceContext(ctx) { - val executor = Kamon(Play)(Akka.system()).defaultDispatcher - val segmentHandle = TraceRecorder.startSegment(HttpClientRequest(request.url), basicRequestAttributes(request)) - val response = pjp.proceed().asInstanceOf[Future[WSResponse]] + TraceRecorder.currentContext.map { ctx ⇒ + val executor = Kamon(Play)(ctx.system).defaultDispatcher + val segmentHandle = TraceRecorder.startSegment(HttpClientRequest(request.url), basicRequestAttributes(request)) + val response = pjp.proceed().asInstanceOf[Future[WSResponse]] - response.map(result ⇒ segmentHandle.map(_.finish()))(executor) - response - } - case None ⇒ pjp.proceed() - } + response.map(result ⇒ segmentHandle.map(_.finish()))(executor) + response + }.getOrElse(pjp.proceed()) } } |