Skip to main content

Report locust metrics to influxdb.

Project description

locust_influx

Send information about locust requests to influxdb.

Start a container of influxdb locally:

docker run -d --name influxdb -d -p 8086:8086

Start a container of grafana locally:

docker run -d --name grafana -d -p 3000:3000

Crete a new python venv:

pip install locust_influx

Create a test locustfile.py

from locust import TaskSet, HttpLocust, task

from locust_influx import expose_metrics

expose_metrics()


class MyTasks(TaskSet):

    @task
    def get_home(self):
        self.client.get('/')

    @task
    def head_home(self):
        self.client.head('/')

    @task
    def delete_home(self):
        self.client.delete('/')

    @task
    def post_home(self):
        self.client.post('/.')

    @task
    def put_home(self):
        self.client.put('/')


class MyLocust(HttpLocust):
    task_set = MyTasks

Run locust (Change the host to point to desired one):

locust -f ./locustfile.py --no-web --clients 10 --hatch-rate 1 --run-time 60s --host http://localhost:8080

Open your local grafana in the browser at http://localhost:3000/

Import new dashboard from locust_dashboard.json file.

Locust dashboard in grafana

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

locust_influx-0.0.1a1.tar.gz (2.7 kB view hashes)

Uploaded Source

Built Distribution

locust_influx-0.0.1a1-py3-none-any.whl (7.1 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page