excilys/gatling — pull request #565 by skuenzli (2012-06-15 04:38:31+00:00)
Title: Feature: Allow users to extract information from HTTP Request and Response

Allow users to extract information from HTTP Request and Response instances used in the simulation and append the information to the request's line in the simulation log. The extra information is thus available for post-processing.

The extra info extraction functions must have the form:
```scala
(Request => List[String])
(Response => List[String])
```

The extraction functions may be provided to the http configuration instance(s) used in the simulation.

An simple usage of this feature would be to extract the url from the request and the status code from the response:
```scala
val httpConf = httpConfig.baseURL(urlBase)
.requestInfoExtractor((request: Request) => {
List[String](request.getRawUrl)
})
.responseInfoExtractor((response: Response) => {
List[String](response.getStatusCode.toString())
})
```
Implements https://github.com/excilys/gatling/issues/446

---------------------------------------------------

Squashed commit of the following:

commit 2a1552a5a7e88a2222dcb1e37527a1288e52740a
Merge: 234d3a4 7962864
Author: Stephen Kuenzli
Date: Thu Jun 14 20:59:54 2012 -0700

Merge branch 'master' of git://github.com/excilys/gatling into feature-log-more-request-info

commit 234d3a4fce0b3afac6967dd6aee807e5df0340e4
Author: Stephen Kuenzli
Date: Thu Jun 14 20:25:58 2012 -0700

Sanitize extraInfo extracted by users before appending to log.

commit 6076847a672be9d0d4c39b494c7444bd45c9318a
Author: Stephen Kuenzli
Date: Thu Jun 14 19:38:45 2012 -0700

Collect extra response info and pass along.

commit 9bc30c92e67c4372f156cdd3f1a85ad5bff862ff
Author: Stephen Kuenzli
Date: Wed Jun 13 20:58:36 2012 -0700

Use an ArrayList to collect arguments because it can change its size.

commit f2668dc8a83d3b07dc0aba513320eecb9a62443e
Merge: 65b6fe8 a968e84
Author: Stephen Kuenzli
Date: Wed Jun 13 20:01:23 2012 -0700

Merge branch 'master' of git://github.com/excilys/gatling into feature-log-more-request-info

commit 65b6fe87780ea67ed24a24e4c219a5a8ba0a2381
Author: Stephen Kuenzli
Date: Tue Jun 12 21:51:24 2012 -0700

Remove failed attempt to test GatlingAsyncHandlerActor.

commit 649851a15f04609a5571f99754cbbf1a19d12577
Author: Stephen Kuenzli
Date: Tue Jun 12 21:27:07 2012 -0700

Add requestInfoExtractor and responseInfoExtractor to CompileTest to verify support.

commit 45e8f1f6eec34108527b8c567f3cd2aa16ed2cda
Author: Stephen Kuenzli
Date: Mon Jun 11 06:38:04 2012 -0700

Make GatlingAsyncHandlerActor robust against exceptions thrown by extraction functions. Attempt to test GAHA.

commit ca60c587bdd761036c9ece42078b1870efa1b088
Author: Stephen Kuenzli
Date: Sat Jun 9 16:41:55 2012 -0700

Use custom request/response info extraction functions.

commit d24d8f6098d5313f14635d7041b7585fec23e2d5
Author: Stephen Kuenzli
Date: Sat Jun 9 15:31:29 2012 -0700

Correct ScalaDoc.

commit 503756ef4b46dd89bd7bdfe1ebf941019590900e
Author: Stephen Kuenzli
Date: Sat Jun 9 15:21:18 2012 -0700

Append extra information to the log via file data writer.

commit 4d26030f9d2685b603dd74a3f8e3baa5454a122e
Author: Stephen Kuenzli
Date: Sat Jun 9 13:03:22 2012 -0700

Modify RequestRecord to accept extra response info.

commit a2acf75145e2e952610080219c3cd6d5a4b410d6
Author: Stephen Kuenzli
Date: Sat Jun 9 12:48:25 2012 -0700

Annotate Spec with JUnit runner so test will be executed by maven surefire plugin.

commit 7f5a9eff719a0d678b7b5d69404264db63a3db21
Author: Stephen Kuenzli
Date: Sat Jun 9 12:28:04 2012 -0700

Remove pointless scaladoc.

commit d30ff1d94de0bb3df56f6bd79e2807891ebe5d20
Author: Stephen Kuenzli
Date: Sat Jun 9 12:27:23 2012 -0700

Fix compilation error: Update Writers to accept RequestRecord with request info extractor.

commit 27d9c622e92bfb0f92796ad5870d24cfd70ed0a1
Author: Stephen Kuenzli
Date: Sat Jun 9 12:16:08 2012 -0700

Clean-up import.

commit 3b11807c0ab12818e2b6a56650695fd5ffd34a71
Author: Stephen Kuenzli
Date: Sat Jun 9 12:15:38 2012 -0700

Modify HttpProtocolConfiguration to accept an extra information extractor function for responses.

commit 4d707b89fc2071b6a013a035da8df1b6c6b389d6
Author: Stephen Kuenzli
Date: Sat Jun 9 10:50:10 2012 -0700

Modify HttpProtocolConfiguration to accept an extra information extractor function.

commit 639b191c6c2dc649763724f0133c4f155429c01f
Author: Stephen Kuenzli
Date: Sat Jun 9 09:56:39 2012 -0700

Rename to RequestRecordSpec in order to match convention.

commit 79f97f0c952458eb13558bdf43d3379a744513f5
Author: Stephen Kuenzli
Date: Sat Jun 9 09:54:37 2012 -0700

Modify RequestRecord to accept extra information about the request, optionally.