Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using the exporter without the locust WebUI #5

Open
robertocpsilva1 opened this issue Jun 4, 2020 · 1 comment
Open

Using the exporter without the locust WebUI #5

robertocpsilva1 opened this issue Jun 4, 2020 · 1 comment
Labels
good first issue Good for newcomers question Further information is requested

Comments

@robertocpsilva1
Copy link

Is this possible at all?
I have an automated build that spins up a container and runs locust with the headless flag so I can set the run-time.
This means the stats/requests endpoint is not available and the exporter can't read it.

I found a way to get around this by using locust as an API:
example from https://github.com/locustio/locust/blob/master/examples/use_as_lib.py

# setup Environment and Runner
env = Environment(user_classes=[User])
env.create_local_runner()

# start a WebUI instance
env.create_web_ui("127.0.0.1", 8089)

# start a greenlet that periodically outputs the current stats
gevent.spawn(stats_printer(env.stats))

# start the test
env.runner.start(1, hatch_rate=10)

# in 60 seconds stop the runner
gevent.spawn_later(60, lambda: env.runner.quit())

# wait for the greenlets
env.runner.greenlet.join()

# stop the web server for good measures
env.web_ui.stop()

Is there a better way to do this?

@pperzyna pperzyna added question Further information is requested good first issue Good for newcomers labels Jun 29, 2020
@zhkostadinov
Copy link

Any updates on that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants