Hi folks,
just read about new Gating 3 and had a look at the migration guide and I think I’m going to miss the “extraInfoExtractor” - having said that there might be a different way to achieve the same effect
-
When running load test we might have some spurious errors
-
I have the habit of chasing the spurious errors since there could be a good reason why you get that spurious error
-
The accepted way to get more information from other teams is to provide some additional information, e.g. URL, user, correlation id (X-REQUEST-ID), some headers, …
-
This additional information is provided in the Gatling log by using the “extraInfo” as shown below
`
/**
- Add custom-data to the “simulation.log” - see
- HTTP Protocol.
-
- The format of the "simulation.log" is un-documented but seems to be a tab-seperated file
- We use "X-REQUEST-ID" as correlation parameter to track remote calls
*/
private def extractExtraInfo(extraInfo: ExtraInfo): List[String] = {
val statusCode = extraInfo.response.statusCode.getOrElse(0)
if (statusCode >= 300 || extraInfo.status.eq(Status.apply(“KO”))) {
val url = extraInfo.request.getUrl
val user = extraInfo.session.attributes.getOrElse(“user”, “”)
val xRequestId = extraInfo.request.getHeaders.get(“X-REQUEST-ID”)
val requestId = if (xRequestId != null) xRequestId else “”
val acceptHeader = extraInfo.request.getHeaders.get(Accept)
val timestamp = dateFormatter.format(new Date())
val responseBodyString = extractResponseBodyString(extraInfo)
val responseBodyLength = extraInfo.response.bodyLength
List(s"\tURL=$url|USER=$user|STATUS=$statusCode|LENGTH=$responseBodyLength|X-REQUEST-ID=$requestId|TIMESTAMP=$timestamp|ACCEPT=$acceptHeader|RESPONSE=$responseBodyString")
} else {
List("")
}
}
`
So the question is: “How can I get this information with Gatling 3?”