Hello folks,
I’m wondering if it’s possible to build a custom metric and expose it somehow in the reports (CLI output or text file would be fine).
My use case is I’m calling serviceA which itsels calls serviceB and I want to measure the response time of serviceA minus serviceB.
To do that serviceA gives me the response time of serviceB in the response (JSON), thus I expected to be able to build a custom metric which would be “responseTimeInMillis - a value extracted from json response” and output that somewhere.
I’m not familiar with all Gatling concepts yet, thus I’m not sure “metric” is actually a Gatling concept, maybe it’s more an assertion that I need… not sure!
Thanks for your help,
Gaël
I am working on something similar where I will use the influxdb rest API to send timings gathered from responses of other calls I make in a scenario - into an influxdb database. I use . silent on the calls to influxdb so gatling doesn’t report them. I use grafana to visualize the metrics.
I’m my case I am using Gatling to generate load but my services go through Kafka and I am more interested in the full transaction time of asynchronous services than the response times of the http calls that initiated those transactions.
For anyone interested, in my case I was able to easily workaround this by transforming the response like this:
.transformResponse { (session, response) =>
val serviceBResponseTime = // Get it in the response…
response.copy(endTimestamp = response.endTimestamp - serviceBResponseTime)
}
It’s pretty hacky but works perfectly fine for my use case.
Still if there are cleaner approach (for instance if I needed to have both response times), I’m interested!