SvenskaSpel/locust-plugins

where users can get all env var's meaning for locust-plugins and locust-swarm ?

Closed this issue · 7 comments

As a beginner, I finally can use Grafana monitoring locust after suffered a struggled process. In the process, I confused about some env vars like LOCUST_TEST_ENV, I checked code and not find where it set, how to set it and what role it can act. The same problem I have when I tried to use locust-swarm, the guide document says there many env vars which prefix with 'LOCUST-' can be used to control swarm strategy. My questions are:

  1. could you tell me where I can exactly know LOCUST_TEST_ENV?
  2. If it possible, could you make a list for the common using env vars for locust-swarm?
    I wanna use TimescaleListener and swarm together thanks.
  1. That is just terribly documented, basically you'd have to read listeners.py, sorry... It predates the locust init_command_line_parser event, so I didnt add it as a proper parameter (I'll do it when I have the time, and then there will be a help text and everything)
  2. Same thing here :)

Thanks for your reply, I still wanna know how to set LOCUST_TEST_ENV😊, what kinda things I can use to set this env var ,a host URL? could you just give me a example? I'll appreciate about that👍

TimescaleListener tags all logged requests with a target_env, it is just the name of your test environment (a string).

You can set it using the env var LOCUST_TEST_ENV (LOCUST_TEST_ENV=mytestenv locust ...), or override it in the init call to TimescaleListener, like in the example:

@events.init.add_listener
def on_locust_init(environment, **_kwargs):
    TimescaleListener(env=environment, testplan="timescale_listener_ex", target_env="myTestEnv")

There are no other ways to set it atm (you cant do it using a command line argument)

Thanks @cyberw , TilemscaleListener is awesome, Grafana dashboard makes me easily communicate with others. Thank you for your great job.

The need to read the whole files to get the environment files is not too good for new people to the project! Should we document that and send a PR?

A PR would be most welcome.

Just make sure to add undocumented settings as standard arguments, like the ones here:

def add_checks_arguments(parser):

Dont just list them in the readme or something.

Most (all?) variables are now proper parameters and available if you do locust -f file_with_plugins_imported.py --help. All env vars are prefixed with LOCUST_.