Skip to main content

Locust.io 1.X influxdb listener

Project description

locust-influxdb-listener

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

Prerequisites

This package requires locustIO v1.5.0 or greater.

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(
        host = 'localhost',
        port = '8086',
        user = 'admin',
        pwd = 'pass',
        database = 'test-project'
        
        # optional global tags to be added to each metric sent to influxdb
        additional_tags = {
            'environment': 'test',
            'some_other_tag': 'tag_value',
        }
    )
    # 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

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_influxdb_listener-1.0.1.tar.gz (6.5 kB view details)

Uploaded Source

Built Distribution

locust_influxdb_listener-1.0.1-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

Details for the file locust_influxdb_listener-1.0.1.tar.gz.

File metadata

File hashes

Hashes for locust_influxdb_listener-1.0.1.tar.gz
Algorithm Hash digest
SHA256 4e00c2ab023487a1fd7be92da0d53f3ac43410cceedc3072c430528afff1c725
MD5 86a65e1473b225b0e4b0b73d84e39bcd
BLAKE2b-256 85eb9c335c04bcfd47a43547bccdb5eef3293d72c6c77bc5adadfa3b5c4aff19

See more details on using hashes here.

File details

Details for the file locust_influxdb_listener-1.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for locust_influxdb_listener-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f438a382d40483d31ffdcbab416d64dd39276da9db5995fb0e99f9f00f67992e
MD5 8d950b1cd05950a77b29dc621ea0a4d3
BLAKE2b-256 5a12ff25d76dc0ea0132617131e6faf4c3b5b3c94acb0ee7943fe28ba5cd7f83

See more details on using hashes here.

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