1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

[Python] How to retrieve statistics from master node as tests are running

Discussão em 'Python' iniciado por Stack, Setembro 12, 2024.

  1. Stack

    Stack Membro Participativo

    I am running Locust tests using distributed load generation with the flag:

    --processes -1


    I used to get the stats while the tests were running from

    from locust.stats import get_percentile_stats_summary, get_stats_summary


    This does not work any more, and it is just getting stats from different workers. How can I get the combined stats directly from the master node while the tests are running?

    Here is the code to access the stats:

    class MyUser(FastHttpUser):
    wait_time = between(0.1, 0.5)

    def on_start(self):
    self._start_background_task()

    def _background_task(self):
    while True:
    print("Background task running...")
    request_stats = self.environment.stats
    # Calculate total requests
    num_requests = request_stats.num_requests

    Continue reading...

Compartilhe esta Página