-
Notifications
You must be signed in to change notification settings - Fork 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
HttpSession should use response.elapsed for response time #930
Comments
I like this fix for all http requests, my one worry is that other clients might assume there response times are always accurate (as we are assuming this fix would be for http requests) when something might be slowing down there response times - but this could be fixed with some good documentation. |
Hey Joaonc, I spoke with @cgoldberg Suggested "try to get timing from This would make http request response times accurate (the most common use case) while still allowing other non-http clients to estimate a response time. This would need to be added in so locust can work for all types of clients, not just http clients. |
I suspect that response.elapsed doesn't include the total for all requests when the requests client automatically follows redirects (by default)? I guess we could loop over all the responses and add all elapsed together. |
Closing as wontfix, the new geventhttpclient lib used by FastHttpLocust doesnt measure response times internally, so we're stuck having to calculate it. And FastHttpLocust is "the Future" imo. |
As we can see here, the
HttpSession
class is calculating the response time on its own, when theresponse
object already has that information in theelapsed
property:http://docs.python-requests.org/en/master/api/#requests.Response.elapsed
HttpSession
should use that elapse property instead of calculating its own.For a quick, backwards compatible, change, maybe something like:
request_meta["response_time"] = response.elapsed
I think this would give us more accurate representations of the actual response time. Per documentation:
The text was updated successfully, but these errors were encountered: