How to get the duration of a specific scnario?

I am trying to determine the time of a scenario in my simulation. I have two scenarios. One with Kafka, where the record is stored in the database, and another with Rest, where a GET request is made to get a specific record from the same database, which is filled with the record from Kafka. After the record is found, the scenario is exited.

Now I want to have the time how long the REST scenario was executed.

Can you show an example or elaborate a little more your case?

If you want to have collective statistics of dependent requests as max, min pXX etc. you can use Groups:

I have two scenarios in my simulation: the first scenario imports records into a Kafka theme with Gatling Kafka. Then in mircoservice the records are deposited in the DB.
Second scenario: search for a record by ID using REST. This scenario is started in parallel and after it finds the record, the scenario is stopped.
Now I would like to know the duration of the second scenario.

I have thinking about you case and below you have some Example how this can be done in JAVA:

@slandelle @sbrevet what you think about this solution ? I’m wondering if it’s optimal :slight_smile:

@GeMi Your proposition about using groups was fine.
Using println is not scalable.

Without an example from @ArosanAn of its current simulation and an example of value they want, I cannot understand all that is about.

Maybe the duration for 1 virtual user => Groups are the way!
The duration of the injectionProfile? (from the first request of the first user to the last response of the last user) => We don’t have that and really, I don’t understand the use case.


I think that he have Scenario where he have in loop exec until some condition is true and he want known how long have take this Scenario - every VU seperately.
Groups will show max,min, pXX etc. but if he want to have information about every Scenario he must calculate how long it take - I’m not sure how get this from simulation.log.
Println is only example - he should save this information in some way.

Having the list of all data is impossible when we’re dealing with hundreds of thousands of VUs. Having the distribution (min pXX max) is the best representation (known today) for this kind of metrics.

For low numbers, println will help to debug. But sparse numbers are not representative.


Thank you @GeMi that is exactly what I want. Is it possible to enter the value (“howlong”) in the report?

@ArosanAn this is little tricky as @sbrevet write:

Is imposible to insert to report, you can try to prepare solution with Groups as I mentioned:

The solution with the groups is exactly what I want. Thanks a lot for that.