How to emulate the removed "extraInfoExtractor" in Gatling 3

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 :slight_smile:

  • 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?”

https://gatling.io/docs/current/general/debugging/ (will be republished when we’ll release RC3, see https://github.com/gatling/gatling/blob/master/src/sphinx/general/debugging.rst)

Hi Stephane,

thx - I going to have a closer look at the log file output when RC3 is released

Thanks in advance,

Siegfried Goeschl

I also use the extraInfoExtractor to fetch errors that might occur during simulations. Setting the log level to DEBUG doesn’t seem to only log the failing requests but also some other stuff which fills up the log. I would rather have a clean option that ONLY logs the failing requests in addition to the usual log (as we could with extraInfoExtractor). No workarounds on that?

Are you lowering the root level to DEBUG or the specific logger as mentioned in the logback.xml?
https://github.com/gatling/gatling/blob/master/gatling-core/src/main/resources/logback.dummy#L11-L13

Oh, yeah. I had the logger set to “logger name=“io.gatling.http””. Changing to “logger name=“io.gatling.http.engine.response”” did the job.

Thank you!