diff options
author | Diego <diegolparra@gmail.com> | 2015-04-28 00:31:57 -0300 |
---|---|---|
committer | Diego <diegolparra@gmail.com> | 2015-04-28 00:31:57 -0300 |
commit | 74134d76363fb4a985b2b64b12d4d07d8006de54 (patch) | |
tree | 4695126eeced6fcf8a052540d61e2ac11a902fb0 /kamon-play/src/main/scala/kamon/play/instrumentation/WSInstrumentation.scala | |
parent | c6ba11c2238b85746ac525505b5dbc7e517eb9f9 (diff) | |
download | Kamon-74134d76363fb4a985b2b64b12d4d07d8006de54.tar.gz Kamon-74134d76363fb4a985b2b64b12d4d07d8006de54.tar.bz2 Kamon-74134d76363fb4a985b2b64b12d4d07d8006de54.zip |
! play: use SameThreadExecutionContext in Request and WS instrumentation in order to achieve more accurate metrics
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 | 5 |
1 files changed, 2 insertions, 3 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 db95047d..3a7c9563 100644 --- a/kamon-play/src/main/scala/kamon/play/instrumentation/WSInstrumentation.scala +++ b/kamon-play/src/main/scala/kamon/play/instrumentation/WSInstrumentation.scala @@ -19,10 +19,10 @@ package kamon.play.instrumentation import kamon.Kamon import kamon.play.Play import kamon.trace.{ Tracer, SegmentCategory } +import kamon.util.SameThreadExecutionContext import org.aspectj.lang.ProceedingJoinPoint import org.aspectj.lang.annotation.{ Around, Aspect, Pointcut } import play.api.libs.ws.{ WSRequest, WSResponse } - import scala.concurrent.Future @Aspect @@ -35,12 +35,11 @@ class WSInstrumentation { def aroundExecuteRequest(pjp: ProceedingJoinPoint, request: WSRequest): Any = { Tracer.currentContext.collect { ctx ⇒ val playExtension = Kamon(Play) - val executor = playExtension.defaultDispatcher val segmentName = playExtension.generateHttpClientSegmentName(request) val segment = ctx.startSegment(segmentName, SegmentCategory.HttpClient, Play.SegmentLibraryName) val response = pjp.proceed().asInstanceOf[Future[WSResponse]] - response.map(result ⇒ segment.finish())(executor) + response.map(result ⇒ segment.finish())(SameThreadExecutionContext) response } getOrElse pjp.proceed() } |