Async HTTP Requests using Futures

Hello,

I would like to execute a couple of requests in chain asynchronously, so that they do not block the requests that follow them. I tried doing this by wrapping the request execution in a Future:

`

def asyncRequest(req: => HttpRequestBuilder, max_time: Long): ChainBuilder = {
val future = Future {
exec(req)
}

f.onComplete {
case Success(result) => result
case Failure(e) => exec(session => session.set(
req.commonAttributes.requestName + " - Timeout",
session.get(req.commonAttributes.requestName + " - Timeout").as[Integer] + 1
))
}

exec()
}

`

And then doing

`
val myScenario = during(…) {
exec(req1)
.exec(asyncRequest(req2))
.exec(req3)
}

`

The request req2 does get made successfully, since the necessary operation happens on the test server, but that request does not appear in Gatling’s HTML report.

My question is:

  1. Why do metrics for that request not appear in the report?
  2. Is there a better way of doing this?

Thank you very much!

Im using Gatling 2.3, btw