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
Hi, recently I needed to load test an elasticsearch cluster and for what it's worth, I wasn't interested in connection time, only in the work time spent by the ES server. Elasticsearch returns that data as part of a JSON response, under a took key. I wanted to measure that, so I hacked this:
if response.status_code not in [200, 300, 301, 302, 303]:
response.failure("Status different from 200")
else:
resp = json.loads(response.content)
events.request_success.fire(
request_type=response.locust_request_meta["method"],
name=response.locust_request_meta["name"],
response_time=resp['took'],
response_length=response.locust_request_meta["content_size"],
)
response._is_reported = True
I think it could be wrapped in something much nicer, e.g.:
if response.status_code not in [200, 300, 301, 302, 303]:
reporting.record_failure(response)
else:
reporting.record_success(response, took=10)
I was interested if anyone else is interested in being added to locust
The text was updated successfully, but these errors were encountered:
Rather than modifying Locust, I would probably write a small custom client (which wraps python-requests or some other HTTP client) that fires the request_success & request_failure events.
I'm not sure I understand what you're proposing. Is it the API for fire:ing request_success/request_failure that you think could be simplified?
I think I understand your approach better now. I think you lack good docs on how one should approach doing such custom stuff, though I've got the idea now how to port my code. Can I contribute it as an example?
Hi, recently I needed to load test an elasticsearch cluster and for what it's worth, I wasn't interested in connection time, only in the work time spent by the ES server. Elasticsearch returns that data as part of a JSON response, under a took key. I wanted to measure that, so I hacked this:
I think it could be wrapped in something much nicer, e.g.:
I was interested if anyone else is interested in being added to locust
The text was updated successfully, but these errors were encountered: