k6
k6 copied to clipboard
`--http-debug=error` to log only failures
--http-debug logs all the requests.
When debugging a large test, it might be useful to have an option to log only failing requests.
Suggested Solution
k6 could provide new HTTP debugging options:
--http-debug=error: log only failing requests.--http-debug=fullError: log only failing requests including the body data.
This can be quite useful, though implementing it will be a bit tricky and may require some unexpected refactoring, for at least 2 different reasons:
- the dumping of HTTP requests happens very independently of the "business logic" checks of HTTP requests like "is this request an error" and it will be difficult to mesh, i.e. we're likely going to have to re-implement the "is this an error" logic in there and not support things like
http.expectedStatuses - the dumping of the HTTP request currently happens independently of dumping the HTTP response (which matters when there are many concurrent requests or redirects, for example), but for
--http-debug=errorwe'd probably need to change this and keep the request buffered until we know the response resulted in an error
As a daily k6 user I believe it is more than necessary to be able to enable logging to console or file only failed http requests, in order for easier debugging of failed http requests. Using --http-debug="full" logs all requests and navigating through the logs (for failed ones) is extremely hard, especially when errors happen only using high loads of users.