SvenskaSpel / locust-plugins

A set of useful plugins/extensions for Locust
Apache License 2.0
526 stars 136 forks source link

can not start locust and write data to Timescaledb #158

Closed wohui closed 5 months ago

wohui commented 5 months ago

I refer to this: https://github.com/SvenskaSpel/locust-plugins/tree/master/locust_plugins/dashboards. I started Timescaledb using Docker Compose, 截屏2024-01-05 下午10 21 52 截屏2024-01-05 下午10 25 41

but when I ran locust, I got an error(locust: error: unrecognized arguments: --timescale ) How can I start locust and write data to Timescaledb? Did I miss something?

cyberw commented 5 months ago

Are you using the latest locust-plugins (4.3.2)?

try running pip show locust-plugins and paste the output here.

wohui commented 5 months ago

yes ,is 4.3.2,now i meet two depenend lib info ModuleNotFoundError: No module named 'psycopg2' [2024-01-05 23:16:17,691] huideMac-mini.local/ERROR/root: 'psychogreen' is not installed by default, you need to install it using 'pip install locust-plugins[dashboards]' I installed it separately and it has been resolved.

psycogreen==1.0.2 psycopg2-binary=2.9.9

cyberw commented 5 months ago

the error message literally says what you should do :)

ModuleNotFoundError: No module named 'psycopg2' [2024-01-05 23:16:17,691] huideMac-mini.local/ERROR/root: 'psychogreen' is not installed by default, you need to install it using 'pip install locust-plugins[dashboards]'

wohui commented 5 months ago

the error message literally says what you should do :)

ModuleNotFoundError: No module named 'psycopg2' [2024-01-05 23:16:17,691] huideMac-mini.local/ERROR/root: 'psychogreen' is not installed by default, you need to install it using 'pip install locust-plugins[dashboards]'

I want to ask how does Grafana know the username and password of Timescaledb? I found that my Grafana dashboard did not get the data, but Timescaledb already had the data.

cyberw commented 5 months ago

it is configured when the docker image is built (check grafana_setup.sh in the repo).

you can customize it if necessary, but it is somewhat undocumented so you'll need to figure it out yourself :)

wohui commented 5 months ago

very thanks and I suggest adding instructions on setting PostgreSQL environment variables in the readme file to help users better handle environmental. This can make the project easier to understand and use, and reduce the difficulties users may encounter during configuration. like import os os.environ['PGHOST'] = '127.0.0.1' os.environ['PGUSER'] = 'postgres' os.environ['PGPASSWORD'] = '' os.environ['PGDATABASE'] = 'postgres'

def on_locust_init(self,environment, **_kwargs): listeners.Timescale(env=environment, testplan="timescale_listener_ex")