Skip to content

LocustIO base project with a custom influxDB listener.

License

Notifications You must be signed in to change notification settings

obriat/locust-influxdb-listener

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

locust-influxdb-listener

Package that uses locust 'event' hooks to push locust related events to an influxDB database.

Installation

Install using your favorite package installer:

pip install locust-influxdb-listener
# or
easy_install locust-influxdb-listener

Usage

Import the library and use the event.init hook to register the listener.

...
from locust_influxdb_listener import InfluxDBListener, InfluxDBSettings

@events.init.add_listener
def on_locust_init(environment, **_kwargs):
    """
    Hook event that enables starting an influxdb connection
    """
    # this settings matches the given docker-compose file
    influxDBSettings = InfluxDBSettings(
        influx_host = 'localhost',
        influx_port = '8086',
        user = 'admin',
        pwd = 'pass',
        database = 'test-project'
    )
    # start listerner with the given configuration
    InfluxDBListener(env=environment, influxDbSettings=influxDBSettings)
...

Example

You can find a working example under the examples folder

InfluxDB with Grafana

We have included a working example docker-compose.yml file that can be used to spin a reporting setup in case you don't have one.

(Make sure you have docker and docker-compose installed and just run:

docker-compose up

Configuration

Once grafana is running (by default on port: 3000) https://localhost:3000 , you need to:

  • Connect to influxdb as the datasource:

  • Import a new dashboard. We have provided a custom dashboard for you locust-grafana-dashboard.json that just works out of the box with the locust-events that the listener will emmit.

Grafa Example

About

LocustIO base project with a custom influxDB listener.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%