# Capturing Load Time for looping API call

**URL:** <https://community.gatling.io/t/capturing-load-time-for-looping-api-call/9875>\
**Category:** Gatling (Open-Source)\
**Created:** [June 16, 2026, 5:07pm UTC](https://community.gatling.io/t/capturing-load-time-for-looping-api-call/9875 "2026-06-16T17:07:00Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Timmer](https://avatars.discourse-cdn.com/v4/letter/t/bb73d2/32.png) [@Timmer](https://community.gatling.io/u/Timmer)\
**Post date:** [June 16, 2026, 5:07pm UTC](https://community.gatling.io/t/capturing-load-time-for-looping-api-call/9875/1 "2026-06-16T17:07:00Z")

</div>

**Gatling version** : 3.15.1  
**Gatling flavor** : java kotlin scala javascript typescript  
**Gatling build tool** : maven gradle sbt bundle npm

I made sure I’ve update my Gatling version to the latest release  
 I read the [guidelines](https://community.gatling.io/t/welcome-in-the-gatling-community-our-code-of-conduct/6462) and [how to ask a question](https://community.gatling.io/t/how-to-ask-a-question/6538) topics.  
 I provided a [SSCCE](http://www.sscce.org/) (or at least, all information to help the community understand my topic)  
 I copied output I observe, and explain what I think should be.

Hello Community,  
I have a scenario where I have an HTTP request which starts a process on the backend to summarize some data. The request returns a JSON response with a status value of ‘SUMMARIZING’.  
I need to create a loop that continues to make that request until the status value in the response returns ‘SUMMARIZED’. There is 1 second pause between requests in the loop. The load time I want is the TOTAL time it takes to get a response status value of ‘SUMMARIZED’, which would include the pauses in between requests. I know it takes about an avg of 40 seconds to summarize the data. What is the best way to simulate this in Gatling and capture the total response time including pauses? Any help would be appreciated. Currently I am only able to capture the time of the request itself not the cumulative time of all the requests in the loop including the pause time?

Thanks,  
Timmer

---

<div class="post-metadata">

**Author:** ![slandelle](https://dub1.discourse-cdn.com/flex013/user_avatar/community.gatling.io/slandelle/32/4_2.png) [@slandelle](https://community.gatling.io/u/slandelle)\
**Post date:** [June 16, 2026, 8:47pm UTC](https://community.gatling.io/t/capturing-load-time-for-looping-api-call/9875/2 "2026-06-16T20:47:43Z")

</div>

What you’re looking for is `group`: [Gatling scenario scripting reference](https://docs.gatling.io/concepts/scenario/#group)

---

<div class="post-metadata">

**Author:** ![Timmer](https://avatars.discourse-cdn.com/v4/letter/t/bb73d2/32.png) [@Timmer](https://community.gatling.io/u/Timmer)\
**Post date:** [June 16, 2026, 9:08pm UTC](https://community.gatling.io/t/capturing-load-time-for-looping-api-call/9875/3 "2026-06-16T21:08:04Z")

</div>

Hello Slandelle,  
I have tried the following code and the first group just gives me the timings of the “AthenaAdvisorSummarizationWindowNoResponses20260528\_3” call itself based on the number of requests made until the request returns the ‘SUMMARIZED’ status back:

```java
exec(session -> session.set("loop_start_time", System.currentTimeMillis()).set("loop_attempt_count", 0)),
group("AthenaAdvisorSummarization_Loop").on(
  asLongAs(session -> {
            String status = session.getString("summarization_status");
            return status == null || !status.equals("SUMMARIZED");
  }).on(
    exec(session -> {
      int currentCount = session.getInt("loop_attempt_count");
      return session.set("loop_attempt_count", currentCount + 1);
    }),
    http("AthenaAdvisorSummarizationWindowNoResponses20260528_3:GET_http://athena-advisor-int3/api/claim/#{claimNo}/summary-with-tracking?regenerate=false&attemptNumber=1")
      .get(athenaAdvisorBaseUrl + "/api/claim/#{claimNo}/summary-with-tracking?regenerate=false&attemptNumber=1")
      .headers(headers_advisor_popup_api)
      .check(regex("summarization_status\\\\?\":\\\\?\"(.*?)\\\\?\"").saveAs("summarization_status")),
    pause(1)
  )
),

```

Am I grouping incorrectly?

Thanks,  
Timmer

---

<div class="post-metadata">

**Author:** ![slandelle](https://dub1.discourse-cdn.com/flex013/user_avatar/community.gatling.io/slandelle/32/4_2.png) [@slandelle](https://community.gatling.io/u/slandelle)\
**Post date:** [June 16, 2026, 9:18pm UTC](https://community.gatling.io/t/capturing-load-time-for-looping-api-call/9875/4 "2026-06-16T21:18:30Z")

</div>

See the explanation here about the `group` timings: [Timings](https://docs.gatling.io/concepts/timings/#cumulated-response-time)

In the Gatling OSS reports, you can only have one metric at a time: either “cumulated response time” (default) or group duration. You want the latter.

---

<div class="post-metadata">

**Author:** ![system](https://europe1.discourse-cdn.com/flex013/uploads/gatling2/original/2X/b/b148e0742de35c6280726cabf3ecd3de2d320f63.png) [@system](https://community.gatling.io/u/system)\
**Post date:** [July 16, 2026, 9:18pm UTC](https://community.gatling.io/t/capturing-load-time-for-looping-api-call/9875/5 "2026-07-16T21:18:54Z")

</div>

Closed on July 16, 2026, 9:18pm UTC

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