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
See what request generated a failure #103
Comments
Indeed, this has been on the todo list for a while. If time allows, I'll see if I can get this sorted once and for all. |
I agree. We just have to make sure to use sampling of data, so that we don't end up using up all bandwidth when running Locust distributed with a lot of slaves. |
About the number of samples, one of the issues that I have found is that the app I am load testing uses lot of unique urls, which makes the web interface heavy to load, or even impossible |
You can name your requests using the name parameter to .get(), .post() etc. l.get("/profile/%d" % user_id, name="/profile/[user-id]") |
You can use Event hooks, like: from locust.events import request_failure
def on_failure(request_type, name, response_time, exception, **kwargs):
print exception.request.url
print exception.response.status_code
print exception.response.content
request_failure += on_failure |
The above is an excellent debugging tip. |
perhaps something like https://github.com/BenjamenMeyer/locust/tree/enhancement_track_responses would be good? It's more specific to an API that I'm developing, but it could probably be generalized by making the 'transaction-id' header field name a configuration variable. |
If it isnt already in there, we should add @Alerion ’s suggestion to the documentation. Closing this. |
Now in master it doesn't work, probably the API is changed and the API docs are not yet up-to-date. I get:
|
The docs are up to date here: https://docs.locust.io/en/latest/api.html#event-hooks |
Ah, my bad, thank you! |
Hi All I got "TypeError: unsupported operand type(s) for +=: 'EventHook' and 'function'" I solved it by adding locust.events to requests. Then now I am getting new error I am using all latest version python --3.8 Can you please help fix this error what eactly is reason for this error and what package needs to be updated. |
I have the same error, how can I solve it? |
It would be very to nice to able to see what http request generated a failure. It also would be useful to include the payload that was sent with the request.
The text was updated successfully, but these errors were encountered: