Track which queries are executed within specified time frame and which outside it

I was wondering if there is a way to track which queries in a group are executed within a specified time frame and which - outside of it.
So if we have the group “groupName” with queries run in parallel: “query_1”, “query_2”, “query_3”, etc. Is it possible to mark in the report which of these queries are executed in the first, let’s say 2 sec?

Define request name with a function that would make use of the elapsed time?

Could you please explain what you are trying to achieve exactly?

Lets say I have this code, recorded with the Gatling recorder:

 ScenarioBuilder scn = scenario("ResetPasswordAndSignIn")
	group("Open https://google.com").on(exec(
        http("request_0")
          .get("/")
          .headers(headers_0)
          .resources(
            http("request_1")
              .get(uri1)
              .headers(headers_1),
            http("request_2")
              .get(uri2)
              .headers(headers_2),
            http("request_3")
              .get(uri3)
              .headers(headers_3)
			  )
      )
)

setUp(scn.injectOpen(atOnceUsers(1))).protocols(httpProtocol);

Because these requests: “request_1”, “request_2”, and “request_3” are executed in parallel, I want to know which of them will be completed in the first 3s from the moment the group’s execution begins, and which of them - after that timeframe. So I’m wondering if there is a way to show that in the report.

If I understand correctly, the group requests are listed in the report in the order in which they are performed - the first completed request is listed first and so on. So it seems logical to me to be able to note in the report which requests were able to complete within the first 3 seconds of starting the group execution and which did not.

Sorry, I still don’t get how this would be helpful. But your call.

Then, sadly, I don’t see a way to achieve this.

Thank you anyway for your help

HI @slandelle and @kribor
I was thinking about this case and I think that what will do the job here is Generic Check Types → responseTimeInMillis

Below you have my Simulation proposition that show when response time from resource is greather than 630 ms.

package pl.gemiusz;

import io.gatling.javaapi.core.ScenarioBuilder;
import io.gatling.javaapi.core.Simulation;
import io.gatling.javaapi.http.HttpProtocolBuilder;

import java.time.Duration;

import static io.gatling.javaapi.core.CoreDsl.*;
import static io.gatling.javaapi.http.HttpDsl.http;

public class Case0021CheckResourcesResponseTimeSimulation extends Simulation {

    HttpProtocolBuilder httpProtocol =
            http
                    .baseUrl("https://postman-echo.com");


    ScenarioBuilder scn =
            scenario("GeMi_CheckResourcesResponseTimeSimulation")
                    .exec(
                            http("GeMi_CheckResourcesResponseTimeSimulation_get")
                                    .get("/get?foo=01234")
                                    .check(jmesPath("args.foo").isEL("01234"))
                                    .resources(
                                            http("GeMi_CheckResourcesResponseTimeSimulation_async_0")
                                                    .get("/get?foo=0")
                                                    .check(jmesPath("args.foo").isEL("0"))
                                                    .check(responseTimeInMillis().lte(630)),
                                            http("GeMi_CheckResourcesResponseTimeSimulation_async_1")
                                                    .get("/get?foo=1")
                                                    .check(jmesPath("args.foo").isEL("1"))
                                                    .check(responseTimeInMillis().lte(630)),
                                            http("GeMi_CheckResourcesResponseTimeSimulation_async_2")
                                                    .get("/get?foo=2")
                                                    .check(jmesPath("args.foo").isEL("2"))
                                                    .check(responseTimeInMillis().lte(630)),
                                            http("GeMi_CheckResourcesResponseTimeSimulation_async_3")
                                                    .get("/get?foo=3")
                                                    .check(jmesPath("args.foo").isEL("3"))
                                                    .check(responseTimeInMillis().lte(630)),
                                            http("GeMi_CheckResourcesResponseTimeSimulation_async_4")
                                                    .get("/get?foo=4")
                                                    .check(jmesPath("args.foo").isEL("4"))
                                                    .check(responseTimeInMillis().lte(630))
                                    )
                    );

    {
        setUp(scn.injectOpen(constantUsersPerSec(1).during(Duration.ofSeconds(30))).protocols(httpProtocol));
    }
}

How it’s look like in Details:

  • responseTimeInMillis doesn’t start counting from the start of the resources group. If you have more requests in there than the max number of connections, it wouldn’t produce (what I understood to be) the expected metric.
  • it would mark the request as a failure, not sure that’s the desired result

I think I found an easy solution - the simulation.log file logs all queries with their start and end times as a timestamp. So I’m just tracking all queries with end time > the group start time + desired duration.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.