Not sure if it will work, but you can try changing the WorkerRunner
id via environment.runner.client_id
. By then it might be too late, though, as the init
event that you use to access environment
is fired after the worker makes a connection to the master and has passed along its id and the master may reject worker reports if the id changes.
I have used Locust in AWS by starting EC2 instances and then starting Docker containers I've built of my Locust file and such. When you do it that way you can change the hostname via Docker's --hostname
option for the run
command, which I've used successfully to accomplish the same result you're looking for.
If Azure Container Instances don't have an equivalent to that, your only other option might be to find another way to change the hostname before Locust starts. You could try some suggestions in this answer to change the hostname in a script you run as part of your entry point script or during build:
Dockerfile HOSTNAME Instruction for docker build like docker run -h