Skip to content
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

Support detailed logging for failed requests #864

Closed
gboorse opened this issue Aug 15, 2018 · 3 comments
Closed

Support detailed logging for failed requests #864

gboorse opened this issue Aug 15, 2018 · 3 comments
Labels

Comments

@gboorse
Copy link

gboorse commented Aug 15, 2018

Description of issue / feature request

Log all failed requests to a CSV or JSON file. Any time an HTTP request is marked as failure, log details of that request to a CSV file.

Currently we only have the capability to export summary information to a CSV file, but it is incredibly useful to correlate timestamps and details of requests to timestamps in service/application

Exporting request details is a critical part of analyzing the results of any performance test.

The expectation would also be that this functionality would work when running Locust headlessly.

Expected behavior

Desired fields would be, at the very least: request timestamp, request duration, response status code, response body, and perhaps some headers.

Actual behavior

Locust does not appear to have any useful support for this feature in its current state.

Some similar but not identical issues include: #675 #774

@gboorse gboorse changed the title Support detailed failed request logging Support detailed logging for failed requests Aug 15, 2018
@gboorse
Copy link
Author

gboorse commented Aug 16, 2018

A workaround for this could be something like:

from locust import events
def request_failure_handler(request_type, name, response_time, exception, **kwargs):
    # some logic
    pass
events.request_failure += request_failure_handler

To get the response body/headers/etc you can use the exception parameter which is a subclass of requests.exceptions.RequestException
http://docs.python-requests.org/en/master/_modules/requests/exceptions/

But it would be really useful to make this a command-line argument similar to how we export the distribution csv

@cyberw
Copy link
Collaborator

cyberw commented Oct 31, 2019

Is this solved by PR #999 ?

@cyberw cyberw closed this as completed Oct 31, 2019
@heyman
Copy link
Member

heyman commented Oct 31, 2019

No solved by #999 I think, but I don't think the use-case for this is common enough for it to be included in Locust itself when you can easily achieve it yourself by using the request_failure event.

@heyman heyman added the wontfix label Oct 31, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants