We are sending post requests to /placeorder, which will redirect to /orderdetail?p={orderid}. Because the order detail page url is unique, it results in a lot of requests recorded in k6. Sending requests with redirects = 0 helps a bit but we still want to load the order detail page. I tried with adding a tag to /placeorder/ but it seems to have no effect on the redirect. How can we group them?
The example that I’ve given is with redirects and it does change the name for both the redirect(s) and the initial request.
Can you provide an example that doesn’t make it?
I’m not able to reproduce the behavior you’re seeing. Which k6 version are you using (output of k6 version) and how are you running k6? Is it a local CLI test or a k6 Cloud run?
Here’s what I see on v0.28.0:
script.js:
import http from 'k6/http';
export default function () {
http.post(
'https://httpbin.test.k6.io/redirect-to?url=https%3A%2F%2Fhttpbin.test.k6.io%2Fredirect%2F3',
{}, {tags: {name: "OrderConfirmation"}},
);
}
Running k6 run -o json=results.json script.js produces the results.json, which when filtered with jq shows the name tag is the same for all requests:
Do they have the correct name tag?
Because if k6 does a request it currently will always emit metrics for it, the only thing the tag does is to have a way of you grouping those many requests as part of one.
With my code I was able to group it like this, which works for me. If I simply add name to the POST requests, then it is recorded as individual requests
and also Too many urls warning is displayed.
I am new to this so I’m not sure if I’m doing it right. Thank you both for looking into this.