diff options
Diffstat (limited to 'kamon-play/src')
4 files changed, 5 insertions, 18 deletions
diff --git a/kamon-play/src/main/scala/kamon/play/action/KamonTraceActions.scala b/kamon-play/src/main/scala/kamon/play/action/KamonTraceActions.scala index 0e777fd5..36eabf8e 100644 --- a/kamon-play/src/main/scala/kamon/play/action/KamonTraceActions.scala +++ b/kamon-play/src/main/scala/kamon/play/action/KamonTraceActions.scala @@ -21,7 +21,7 @@ import play.api.mvc._ import scala.concurrent.Future case class TraceName[A](name: String)(action: Action[A]) extends Action[A] { - def apply(request: Request[A]): Future[SimpleResult] = { + def apply(request: Request[A]): Future[Result] = { TraceRecorder.rename(name) action(request) } 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 fce5ca13..8595c348 100644 --- a/kamon-play/src/main/scala/kamon/play/instrumentation/WSInstrumentation.scala +++ b/kamon-play/src/main/scala/kamon/play/instrumentation/WSInstrumentation.scala @@ -20,9 +20,9 @@ import org.aspectj.lang.annotation.{ Around, Pointcut, Aspect } import org.aspectj.lang.ProceedingJoinPoint import kamon.trace.TraceRecorder import kamon.metrics.TraceMetrics.HttpClientRequest -import play.api.libs.ws.WS.WSRequest +import play.api.libs.ws.WSRequest import scala.concurrent.Future -import play.api.libs.ws.Response +import play.api.libs.ws.WSResponse import scala.util.{ Failure, Success } import scala.concurrent.ExecutionContext.Implicits.global @@ -38,7 +38,7 @@ class WSInstrumentation { val completionHandle = TraceRecorder.startSegment(HttpClientRequest(request.url, UserTime), basicRequestAttributes(request)) - val response = pjp.proceed().asInstanceOf[Future[Response]] + val response = pjp.proceed().asInstanceOf[Future[WSResponse]] response.onComplete { case Failure(t) ⇒ completionHandle.map(_.finish(Map("completed-with-error" -> t.getMessage))) diff --git a/kamon-play/src/test/scala/kamon/play/RequestInstrumentationSpec.scala b/kamon-play/src/test/scala/kamon/play/RequestInstrumentationSpec.scala index 0c4ac57b..b14fe996 100644 --- a/kamon-play/src/test/scala/kamon/play/RequestInstrumentationSpec.scala +++ b/kamon-play/src/test/scala/kamon/play/RequestInstrumentationSpec.scala @@ -24,7 +24,6 @@ import scala.concurrent.ExecutionContext.Implicits.global import scala.concurrent.Future import org.junit.runner.RunWith import org.specs2.runner.JUnitRunner -import play.api.mvc.AsyncResult import play.api.test.FakeApplication import kamon.play.action.TraceName @@ -34,14 +33,6 @@ class RequestInstrumentationSpec extends PlaySpecification { System.setProperty("config.file", "./kamon-play/src/test/resources/conf/application.conf") val appWithRoutes = FakeApplication(withRoutes = { - case ("GET", "/asyncResult") ⇒ - Action { - AsyncResult { - scala.concurrent.Future { - Ok("AsyncResult") - } - } - } case ("GET", "/async") ⇒ Action.async { Future { @@ -76,11 +67,6 @@ class RequestInstrumentationSpec extends PlaySpecification { private val traceTokenHeader = traceTokenHeaderName -> traceTokenValue "the Request instrumentation" should { - "respond to the asyncResult action with X-Trace-Token" in new WithServer(appWithRoutes) { - val Some(result) = route(FakeRequest(GET, "/asyncResult").withHeaders(traceTokenHeader)) - header(traceTokenHeaderName, result) must equalTo(expectedToken) - } - "respond to the Async Action with X-Trace-Token" in new WithServer(appWithRoutes) { val Some(result) = route(FakeRequest(GET, "/async").withHeaders(traceTokenHeader)) header(traceTokenHeaderName, result) must equalTo(expectedToken) diff --git a/kamon-play/src/test/scala/kamon/play/WSInstrumentationSpec.scala b/kamon-play/src/test/scala/kamon/play/WSInstrumentationSpec.scala index b321d123..ee51d07d 100644 --- a/kamon-play/src/test/scala/kamon/play/WSInstrumentationSpec.scala +++ b/kamon-play/src/test/scala/kamon/play/WSInstrumentationSpec.scala @@ -25,6 +25,7 @@ import org.junit.runner.RunWith import org.specs2.runner.JUnitRunner import play.api.test.FakeApplication import play.api.libs.ws.WS +import play.api.Play.current import scala.util._ import scala.concurrent.Await import scala.concurrent.duration._ |