【问题标题】:How to invoke a GRPC python client in locust?如何在 locust 中调用 GRPC python 客户端?
【发布时间】:2020-07-22 01:29:40
【问题描述】:

有没有办法在locust中调用GRPC python客户端。

当我运行代码locust -f 1.py 时会生成输出。但统计数据不起作用。他们闲着。

用户蜂拥而至,但所有数据都处于空闲状态

【问题讨论】:

    标签: python python-3.x grpc locust grpc-python


    【解决方案1】:

    当你建立自己的客户端时,你需要报告样本来蚱蜢自己(因为否则它怎么会知道你做了什么?)

    https://docs.locust.io/en/stable/testing-other-systems.html

    要报告示例,您需要执行以下操作(如果您从 TaskSet 调用它 - 如果您已经在 User 类中,请跳过 .user 部分):

    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 之前的 locust 中,您会执行以下操作:

    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)
    

    【讨论】:

      猜你喜欢
      • 2021-04-10
      • 2020-04-03
      • 2022-11-17
      • 2022-01-13
      • 2020-10-15
      • 1970-01-01
      • 1970-01-01
      • 2020-11-20
      • 2020-09-09
      相关资源
      最近更新 更多