更新时间:2022-06-15 22:36:06
建立自己的客户时,您需要报告样本来刺槐自己(因为否则它将如何知道您的所作所为?)
When you build your own client you need to report samples to locust yourself (because how would it otherwise know what you had done?)
https://docs.locust.io/en/stable /testing-other-systems.html
要报告示例,您需要执行以下操作(如果从TaskSet调用它-如果您已经在User类中,请跳过.user部分):
To report a sample, you need to do something like this (if you're calling this from a TaskSet - if you are already in the User class, skip the .user part):
self.user.environment.events.request_success.fire(request_type="grpc", name=name, response_time=total_time_calculated_by_you, response_length=your_response_length)
在1.0之前的蝗虫中,您会做类似的事情:
In pre-1.0 locust you'd do something like:
from locust import events,
events.request_success.fire(request_type="grpc", name=name, response_time=total_time_calculated_by_you, response_length=your_response_length)