Skip to main content

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:

    • Host: https://influxdb:8086
    • User: admin
    • Password: pass
  • 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

Release files for locust-influxdb-listener 1.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for locust-influxdb-listener 1.0.2
File Size Uploaded
locust_influxdb_listener-1.0.2.tar.gz 6.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for locust-influxdb-listener 1.0.2
File Interpreter ABI Platform
locust_influxdb_listener-1.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 12.7 kB

Release files / locust_influxdb_listener-1.0.2.tar.gz

Download URL locust_influxdb_listener-1.0.2.tar.gz
Size 6.5 kB
Tags Source
SHA-256 checksum
How to use checksums
881a6463cb8332be14b3ed63cda19e0fff0dbc04cc9952f06be20175d62a115b
BLAKE2b-256 checksum
How to use checksums
81d675280e86cf83a31e50c92e4486b8367441417d3c750ce53136c70b240acf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.18

Release files / locust_influxdb_listener-1.0.2-py3-none-any.whl

Download URL locust_influxdb_listener-1.0.2-py3-none-any.whl
Size 6.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d436cc2aad1ad80c31bc0b3b1b5934c58284faadb56c1b38e7a922482d0ae31e
BLAKE2b-256 checksum
How to use checksums
1b86f3281d16cea76adac4288fc696f4e2f6f13ffdf3cfba8c8b26c8b42bb4c8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.18

Release history Release notifications | RSS feed

This release

1.0.2 This release

2 release files

1.0.1

2 release files

0.0.9

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

3 release files

0.0.4

3 release files

0.0.3

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page