locust: Rename "request" to "sample", and refactor request_success/failure into one event

The word request makes no sense for a lot of non-http protocols. Users could be reporting things like the reception of async WebSocket messages, or the time to run a script. The word sample is more appropriate.

Having separate events for request_success and request_failure make no sense either, so I suggest we deprecate those (but support them for a long time) and just use a single one, sample(with a boolean parameter success).

Perhaps this should be done at the same time https://github.com/locustio/locust/issues/1413

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 15 (5 by maintainers)

Most upvoted comments

What are your feelings about the other part, merging request_success/failure into a single event?

I don’t have a strong opinion about it. But if I were to choose today, I think I’d prefer a single event. So as long as we kept the old ones for backwards compatibility for a long time like you said, I think it’s a good idea to change it.

@DennisKrone is working on a PR to add optional metadata to the event (basically anything you like, things like customer id is a good example).

We’ve also talked about adding the User object, and I think request/response make a lot of sense as well. We just need a sensible behaviour for non-http / custom clients as well.

In the case of join both request_success/failure, I would also think is a good idea to pass the entire request/response object, there are so many cases that it has meaningful info inside it, that would be great to have them instead of the 4 attributes (request_type, name, response_time, response_length)

A metric could represent anything <- Exactly. This is why we should NOT call it a metric.

What you are suggesting is a major rewrite. Which might make sense, but what I’m talking about here is just renaming a couple of things.

As for Grafana, I too love it for visualiization - so much that I have abandoned the Locust GUI, and made this instead https://grafana.com/grafana/dashboards/10878 😃 (on a side note, I use Timescale and log every request, because I’ve always felt that you need every request for analysis later on - particularly error messages etc)