SvenskaSpel/locust-plugins

Locust 1.4.4 + Locust-Plugins 1.2.0 - Listener.py Error Timescale Integration

Closed this issue ยท 4 comments

I've an implementation using Locust and Locust-Plugin inside a docker container.
I use Taurus has wrapper around locust for test execution. My config is setup in such a away that I pip install the Locust-Plugin has part of the pre-execution setup tasks. Today I've observed that the latest update to the locust-plugin broke my integration to the Timescale DB in my case.
Below is the exception I'm getting.

`
[2021-05-08 02:42:36,138] 90f0f3cdb2a5/INFO/root: Follow test run here: http://localhost:3000/d/qjIIww4Zz/locust-ht?orgId=1&from=now-15m&to=now&var-testplan=taurus_cci_listener_ex&from=1620441756138&to=now
[2021-05-08 02:42:36,159] 90f0f3cdb2a5/ERROR/root: Uncaught exception in event handler:
Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/locust/event.py", line 40, in fire
handler(**kwargs)
File "/bzt-configs/locustfile-cci.py", line 40, in on_locust_init
listeners.Timescale(env=environment, testplan="taurus_cci_listener_ex")
File "/tmp/artifacts/python-packages/3.8.5/locust_plugins/listeners.py", line 93, in init
events.request.add_listener(self.on_request)
AttributeError: 'Events' object has no attribute 'request'

[2021-05-08 02:42:36,159] 90f0f3cdb2a5/INFO/locust.main: Run time limit set to 360 seconds
[2021-05-08 02:42:36,160] 90f0f3cdb2a5/INFO/locust.main: Starting Locust 1.4.4
[2021-05-08 02:42:36,161] 90f0f3cdb2a5/INFO/locust.runners: Spawning 250 users at the rate 4.16667 users/s (0 users already running)...
[2021-05-08 02:42:36,163] 90f0f3cdb2a5/INFO/root: Terminal was not a tty. Keyboard input disabled
[2021-05-08 02:43:36,666] 90f0f3cdb2a5/INFO/locust.runners: All users spawned: MyWebsiteUser: 250 (250 total running)

locustfile-cci.py.zip
`

Its pointing to line 93 of the listener.py
I started seeing this error today. To confirm I tested with the previous plugin version
locust-plugins=1.1.7,
I'm not observing this issue and can successfully log the transactions data to the Timescale DB

Locust version 1.4.4
Locust-plugind 1.2.0
timescaledb:2.0.1-pg12

I'm I missing something has part of my locustfile? Any pointer would be greatly appreciated

Hi! locust-plugins 1.2.0 requires locust 1.5 or later!

it is weird that pip even allowed you to install that combination..

You may need to add a jsonb type column in the requests table called context as well (havent updated the schema yet..)

Thanks a lot for the quick response ๐Ÿ™๐Ÿพ
I made the recommended changes and its working now ๐Ÿค“
I've attached the updated timescale_schema has well.
I'll close this issue.

BTW Thanks for creating and maintaining this plugin ๐Ÿค˜๐Ÿพ

timescale_schema_updated.sql.zip

Screen Shot 2021-05-08 at 20 34 06 PM
Screen Shot 2021-05-08 at 20 40 41 PM

Neat! Thanks! :)