You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While this 60s value might make sense for some tests, for others the 60s value might be excessive. The current solution for this is of course to manually specify the desired timeout value for each request, however, that approach has a number of drawbacks:
Users need to be aware of the default timeout being too high, for them to realize they might want to override it.
The resulting code is quite verbose, with every request having this "appendix" to it.
In this situation, it's easy to forget to add the parameter, leading to hard to debug situations
For the particular way we are using k6 internally in Grafana Synthetic Monitoring, there's the additional drawback of not being possible for the SM systems to change this default, as we cannot modify the user's script.
Suggested Solution (optional)
I'd propose to make this default configurable from either the options global, config file, and/or a CLI flag (ideally all of them). In particular, I propose it works as follows:
exportdefaultfunction(){// This request has a 60s timeout.constresponse=http.get('https://test-api.k6.io/public/crocodiles/');}
exportconstoptions={requestTimeout: '5s',};exportdefaultfunction(){// This request has a 5s timeout.constresponse=http.get('https://test-api.k6.io/public/crocodiles/');}
exportconstoptions={requestTimeout: '5s',};exportdefaultfunction(){// This request has a 30s timeout.constresponse=http.get('https://test-api.k6.io/public/crocodiles/',{timeout: '30s'});}
This follows the pattern of other k6 options, such as maxRedirects.
While not being pictured above, for SM in particular it would be important that this option is also exposed as a CLI flag (e.g. --request-timeout), as that would simplify integration into our system.
Already existing or connected issues / PRs (optional)
No response
The text was updated successfully, but these errors were encountered:
Feature Description
k6 currently allows configuring the timeout of an HTTP request individually by means of the
params
argument ofhttp.*
methods, e.g.:If not specified, this defaults to
60s
.While this
60s
value might make sense for some tests, for others the60s
value might be excessive. The current solution for this is of course to manually specify the desired timeout value for each request, however, that approach has a number of drawbacks:For the particular way we are using k6 internally in Grafana Synthetic Monitoring, there's the additional drawback of not being possible for the SM systems to change this default, as we cannot modify the user's script.
Suggested Solution (optional)
I'd propose to make this default configurable from either the
options
global, config file, and/or a CLI flag (ideally all of them). In particular, I propose it works as follows:This follows the pattern of other k6 options, such as
maxRedirects
.While not being pictured above, for SM in particular it would be important that this option is also exposed as a CLI flag (e.g.
--request-timeout
), as that would simplify integration into our system.Already existing or connected issues / PRs (optional)
No response
The text was updated successfully, but these errors were encountered: