-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
k6/execution
: add more information about the current VU
#2260
Comments
A way to atomically query the current |
Hello I am interested in the For our use case we have a test that requires unique data read from an array, we were using the |
@amommersteeg-d2l, there hasn't been any progress here because this issue hasn't been very highly prioritized so far. Thanks for sharing your use case, that helps us to prioritize more accurately and understand what we should build. Please also upvote (:+1:) the issue itself. Unfortunately, if I understand your use case correctly, I don't think there is a workaround you could use before this is implemented... 😞 Test suites (#1342) or a dedicated data segmentation API (#1539) might have offered an alternative, if they were implemented, but they are unlikely to be done any time soon. What is the executor type of your scenario and what does the scenario test? Do you need to always pin the unique data entry per every VU in the scenario? Because if you can change the test to get a unique row on every iteration, then |
@na-- yeah, it looks like you understand the use case correctly. We are using the scenarios in a new script were we import individual tests, so a test suite. It allows use to run a nightly test without having to completely rewrite the individual tests. For some tests we can't have the same user completing the action at the same time, it will case the test to be flaky. Thank you for the idea of using The other option we are looking it is using https://github.com/grafana/xk6-exec to help get unique indexes of a VU from a separate script and file while the VU is being initialized. (Have tested yet, so not sure of the time impact). |
I'm happy that While it's highly unlikely we'd even start properly working on it in the next 6 months (:disappointed:), when it is done, it may be a much nicer solution for your use case (and similar ones) than trying to abuse |
Has there been any updates on this issue? I believe I've got a similar/the same use case that @amommersteeg-d2l has described above. As a workaround, I'm currently calculating the index of a data array I should access using modulus and If anyone is interested, here is my workaround using modulus and
The problem with this though, is that I would prefer having an id for each VU in each scenario. In my case, I want each VU to log in once and generate an authorization token. With my current workaround, I'd have to store the tokens in a map, rather than each individual VU just remembering their own token (because otherwise a VU may try to log in with a certain username, and the token variable it has stored was generated with a different username, leading to an error). A |
This is a continuation of some of the things mentioned in #1320 that relate to information about the current VU, but which were not implemented in the original
k6/execution
API that shipped in k6 v0.34.0.We already offer quite a lot of information through
k6/execution.vu
, but we don't have these:group()
calls can be nested arbitrarily deeply, and when we couple them with some code reuse functions, it might be useful to be able to programmatically get what is the current group. This might become even more relevant if we enhance whatgroup()
can do by implementing Ideas for improving the group() built-in function #884 or something similar...idInScenario
- the ID of the current VU in the current scenario. Since VUs are initialized concurrently after New executors #1007, and since VUs can be reused across scenarios, the currentvu.idInInstance
andvu.idInTest
identifiers are quite jumbled and unsuitable for anything besides partitioning data. This local ID for every scenario could be useful, especially in executors likeramping-vus
where VUs are very ordered and lower-numbered VUs will always be started first and stopped last.The text was updated successfully, but these errors were encountered: