How to emulate the removed "extraInfoExtractor" in Gatling 3

1,062 views
Skip to first unread message

Siegfried Goeschl

unread,
Sep 26, 2018, 12:43:46 PM9/26/18
to Gatling User Group
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
    * <a href="http://gatling.io/docs/2.2.3/http/http_protocol.html">HTTP Protocol</a>.
    * <ul>
    * <li>The format of the "simulation.log" is un-documented but seems to be a tab-seperated file</li>
    * <li>We use "X-REQUEST-ID" as correlation parameter to track remote calls</li>
    * </ul>
    */

 
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?"

Stéphane LANDELLE

unread,
Sep 26, 2018, 4:27:30 PM9/26/18
to gat...@googlegroups.com

--
You received this message because you are subscribed to the Google Groups "Gatling User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gatling+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Siegfried Goeschl

unread,
Sep 27, 2018, 5:37:56 AM9/27/18
to Gatling User Group
Hi Stephane,

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

Thanks in advance, 

Siegfried Goeschl

robert.ha...@hotmail.com

unread,
Oct 15, 2018, 4:03:54 AM10/15/18
to Gatling User Group
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?

Stéphane LANDELLE

unread,
Oct 15, 2018, 4:10:40 AM10/15/18
to gat...@googlegroups.com
Are you lowering the root level to DEBUG or the specific logger as mentioned in the logback.xml?

Stéphane Landelle
GatlingCorp CTO


On Mon, Oct 15, 2018 at 10:03 AM <robert.ha...@hotmail.com> wrote:
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?

--

robert.ha...@hotmail.com

unread,
Oct 15, 2018, 6:01:04 AM10/15/18
to Gatling User Group
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!
Reply all
Reply to author
Forward
0 new messages