locust-plugins 4.3.3__tar.gz → 4.4.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {locust-plugins-4.3.3/locust_plugins.egg-info → locust-plugins-4.4.0}/PKG-INFO +1 -1
- {locust-plugins-4.3.3 → locust-plugins-4.4.0}/examples/distributor_ex.py +10 -14
- locust-plugins-4.4.0/examples/mqtt_custom_client_ex.py +33 -0
- {locust-plugins-4.3.3 → locust-plugins-4.4.0}/examples/playwright_ex.py +1 -1
- {locust-plugins-4.3.3 → locust-plugins-4.4.0}/locust_plugins/_version.py +2 -2
- {locust-plugins-4.3.3 → locust-plugins-4.4.0}/locust_plugins/mongoreader.py +1 -1
- {locust-plugins-4.3.3 → locust-plugins-4.4.0}/locust_plugins/users/mqtt.py +8 -5
- {locust-plugins-4.3.3 → locust-plugins-4.4.0}/locust_plugins/users/socketio.py +1 -1
- {locust-plugins-4.3.3 → locust-plugins-4.4.0/locust_plugins.egg-info}/PKG-INFO +1 -1
- {locust-plugins-4.3.3 → locust-plugins-4.4.0}/locust_plugins.egg-info/SOURCES.txt +1 -0
- {locust-plugins-4.3.3 → locust-plugins-4.4.0}/.github/workflows/stale.yml +0 -0
- {locust-plugins-4.3.3 → locust-plugins-4.4.0}/.github/workflows/tests.yml +0 -0
- {locust-plugins-4.3.3 → locust-plugins-4.4.0}/.gitignore +0 -0
- {locust-plugins-4.3.3 → locust-plugins-4.4.0}/.pylintrc +0 -0
- {locust-plugins-4.3.3 → locust-plugins-4.4.0}/.vscode/launch.json +0 -0
- {locust-plugins-4.3.3 → locust-plugins-4.4.0}/.vscode/settings.json +0 -0
- {locust-plugins-4.3.3 → locust-plugins-4.4.0}/CONTRIBUTING.md +0 -0
- {locust-plugins-4.3.3 → locust-plugins-4.4.0}/LICENSE +0 -0
- {locust-plugins-4.3.3 → locust-plugins-4.4.0}/MANIFEST.in +0 -0
- {locust-plugins-4.3.3 → locust-plugins-4.4.0}/Makefile +0 -0
- {locust-plugins-4.3.3 → locust-plugins-4.4.0}/README.md +0 -0
- {locust-plugins-4.3.3 → locust-plugins-4.4.0}/bin/locust-compose +0 -0
- {locust-plugins-4.3.3 → locust-plugins-4.4.0}/examples/appinsights_listener_ex.py +0 -0
- {locust-plugins-4.3.3 → locust-plugins-4.4.0}/examples/cloudwatch_listener_ex.py +0 -0
- {locust-plugins-4.3.3 → locust-plugins-4.4.0}/examples/cmd_line_examples.sh +0 -0
- {locust-plugins-4.3.3 → locust-plugins-4.4.0}/examples/connection_pool_ex.py +0 -0
- {locust-plugins-4.3.3 → locust-plugins-4.4.0}/examples/constant_total_ips_ex.py +0 -0
- {locust-plugins-4.3.3 → locust-plugins-4.4.0}/examples/csvreader_ex.py +0 -0
- {locust-plugins-4.3.3 → locust-plugins-4.4.0}/examples/embedded_resource_manager_ex.py +0 -0
- {locust-plugins-4.3.3 → locust-plugins-4.4.0}/examples/jmeter_listener_example.py +0 -0
- {locust-plugins-4.3.3 → locust-plugins-4.4.0}/examples/kafka_ex.py +0 -0
- {locust-plugins-4.3.3 → locust-plugins-4.4.0}/examples/mongoreader_ex.py +0 -0
- {locust-plugins-4.3.3 → locust-plugins-4.4.0}/examples/mqtt_ex.py +0 -0
- {locust-plugins-4.3.3 → locust-plugins-4.4.0}/examples/playwright-recording.py +0 -0
- {locust-plugins-4.3.3 → locust-plugins-4.4.0}/examples/products.csv +0 -0
- {locust-plugins-4.3.3 → locust-plugins-4.4.0}/examples/reschedule_on_fail_ex.py +0 -0
- {locust-plugins-4.3.3 → locust-plugins-4.4.0}/examples/rest_ex.py +0 -0
- {locust-plugins-4.3.3 → locust-plugins-4.4.0}/examples/socketio_ex.py +0 -0
- {locust-plugins-4.3.3 → locust-plugins-4.4.0}/examples/ssn.csv +0 -0
- {locust-plugins-4.3.3 → locust-plugins-4.4.0}/examples/ssn.tsv +0 -0
- {locust-plugins-4.3.3 → locust-plugins-4.4.0}/examples/transaction_example.py +0 -0
- {locust-plugins-4.3.3 → locust-plugins-4.4.0}/examples/transaction_example_as_library_local.py +0 -0
- {locust-plugins-4.3.3 → locust-plugins-4.4.0}/examples/transaction_example_as_library_master.py +0 -0
- {locust-plugins-4.3.3 → locust-plugins-4.4.0}/examples/transaction_example_as_library_worker.py +0 -0
- {locust-plugins-4.3.3 → locust-plugins-4.4.0}/examples/tsvreader_ex.py +0 -0
- {locust-plugins-4.3.3 → locust-plugins-4.4.0}/examples/webdriver_ex.py +0 -0
- {locust-plugins-4.3.3 → locust-plugins-4.4.0}/locust_plugins/__init__.py +0 -0
- {locust-plugins-4.3.3 → locust-plugins-4.4.0}/locust_plugins/connection_pools.py +0 -0
- {locust-plugins-4.3.3 → locust-plugins-4.4.0}/locust_plugins/csvreader.py +0 -0
- {locust-plugins-4.3.3 → locust-plugins-4.4.0}/locust_plugins/dashboards/Makefile +0 -0
- {locust-plugins-4.3.3 → locust-plugins-4.4.0}/locust_plugins/dashboards/README.md +0 -0
- {locust-plugins-4.3.3 → locust-plugins-4.4.0}/locust_plugins/dashboards/docker-compose.yml +0 -0
- {locust-plugins-4.3.3 → locust-plugins-4.4.0}/locust_plugins/dashboards/locust-grafana/Dockerfile +0 -0
- {locust-plugins-4.3.3 → locust-plugins-4.4.0}/locust_plugins/dashboards/locust-grafana/Makefile +0 -0
- {locust-plugins-4.3.3 → locust-plugins-4.4.0}/locust_plugins/dashboards/locust-grafana/create_datasource.sh +0 -0
- {locust-plugins-4.3.3 → locust-plugins-4.4.0}/locust_plugins/dashboards/locust-grafana/grafana_setup.sh +0 -0
- {locust-plugins-4.3.3 → locust-plugins-4.4.0}/locust_plugins/dashboards/locust-grafana/import_dashboards.sh +0 -0
- {locust-plugins-4.3.3 → locust-plugins-4.4.0}/locust_plugins/dashboards/locust-timescale/Dockerfile +0 -0
- {locust-plugins-4.3.3 → locust-plugins-4.4.0}/locust_plugins/dashboards/locust-timescale/Makefile +0 -0
- {locust-plugins-4.3.3 → locust-plugins-4.4.0}/locust_plugins/dashboards/locust-timescale/timescale_schema.sql +0 -0
- {locust-plugins-4.3.3 → locust-plugins-4.4.0}/locust_plugins/dashboards/locust-timescale/zz_hypertable.sql +0 -0
- {locust-plugins-4.3.3 → locust-plugins-4.4.0}/locust_plugins/dashboards/screenshots/main_dashboard.png +0 -0
- {locust-plugins-4.3.3 → locust-plugins-4.4.0}/locust_plugins/dashboards/screenshots/main_dashboard_by_request_graphs.png +0 -0
- {locust-plugins-4.3.3 → locust-plugins-4.4.0}/locust_plugins/dashboards/screenshots/requests_table.png +0 -0
- {locust-plugins-4.3.3 → locust-plugins-4.4.0}/locust_plugins/dashboards/screenshots/scatter_plot.png +0 -0
- {locust-plugins-4.3.3 → locust-plugins-4.4.0}/locust_plugins/dashboards/screenshots/testruns.png +0 -0
- {locust-plugins-4.3.3 → locust-plugins-4.4.0}/locust_plugins/distributor.py +0 -0
- {locust-plugins-4.3.3 → locust-plugins-4.4.0}/locust_plugins/listeners/__init__.py +0 -0
- {locust-plugins-4.3.3 → locust-plugins-4.4.0}/locust_plugins/listeners/appinsights.py +0 -0
- {locust-plugins-4.3.3 → locust-plugins-4.4.0}/locust_plugins/listeners/cloudwatch.py +0 -0
- {locust-plugins-4.3.3 → locust-plugins-4.4.0}/locust_plugins/listeners/jmeter.py +0 -0
- {locust-plugins-4.3.3 → locust-plugins-4.4.0}/locust_plugins/listeners/timescale.py +0 -0
- {locust-plugins-4.3.3 → locust-plugins-4.4.0}/locust_plugins/py.typed +0 -0
- {locust-plugins-4.3.3 → locust-plugins-4.4.0}/locust_plugins/transaction_manager.py +0 -0
- {locust-plugins-4.3.3 → locust-plugins-4.4.0}/locust_plugins/users/__init__.py +0 -0
- {locust-plugins-4.3.3 → locust-plugins-4.4.0}/locust_plugins/users/kafka.py +0 -0
- {locust-plugins-4.3.3 → locust-plugins-4.4.0}/locust_plugins/users/playwright.py +0 -0
- {locust-plugins-4.3.3 → locust-plugins-4.4.0}/locust_plugins/users/resource.py +0 -0
- {locust-plugins-4.3.3 → locust-plugins-4.4.0}/locust_plugins/users/rest.py +0 -0
- {locust-plugins-4.3.3 → locust-plugins-4.4.0}/locust_plugins/users/webdriver.py +0 -0
- {locust-plugins-4.3.3 → locust-plugins-4.4.0}/locust_plugins/utils.py +0 -0
- {locust-plugins-4.3.3 → locust-plugins-4.4.0}/locust_plugins/wait_time.py +0 -0
- {locust-plugins-4.3.3 → locust-plugins-4.4.0}/locust_plugins.egg-info/dependency_links.txt +0 -0
- {locust-plugins-4.3.3 → locust-plugins-4.4.0}/locust_plugins.egg-info/not-zip-safe +0 -0
- {locust-plugins-4.3.3 → locust-plugins-4.4.0}/locust_plugins.egg-info/requires.txt +0 -0
- {locust-plugins-4.3.3 → locust-plugins-4.4.0}/locust_plugins.egg-info/top_level.txt +0 -0
- {locust-plugins-4.3.3 → locust-plugins-4.4.0}/mypy.ini +0 -0
- {locust-plugins-4.3.3 → locust-plugins-4.4.0}/pyproject.toml +0 -0
- {locust-plugins-4.3.3 → locust-plugins-4.4.0}/setup.cfg +0 -0
- {locust-plugins-4.3.3 → locust-plugins-4.4.0}/setup.py +0 -0
- {locust-plugins-4.3.3 → locust-plugins-4.4.0}/test/test.csv +0 -0
- {locust-plugins-4.3.3 → locust-plugins-4.4.0}/test/test_all.py +0 -0
- {locust-plugins-4.3.3 → locust-plugins-4.4.0}/test/test_cloudwatch_plugin.py +0 -0
- {locust-plugins-4.3.3 → locust-plugins-4.4.0}/test/test_missing_extras.py +0 -0
- {locust-plugins-4.3.3 → locust-plugins-4.4.0}/tox.ini +0 -0
- {locust-plugins-4.3.3 → locust-plugins-4.4.0}/tusk.yaml +0 -0
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
# that it is entirely possible to have multiple distributors at the same time
|
|
3
3
|
|
|
4
4
|
from typing import Dict, List
|
|
5
|
-
from locust_plugins.mongoreader import MongoLRUReader
|
|
6
5
|
from locust_plugins.csvreader import CSVDictReader, CSVReader
|
|
7
6
|
from locust_plugins.distributor import Distributor
|
|
8
7
|
from locust import HttpUser, task, run_single_user, events
|
|
@@ -13,18 +12,15 @@ distributors = {}
|
|
|
13
12
|
|
|
14
13
|
@events.init.add_listener
|
|
15
14
|
def on_locust_init(environment, **_kwargs):
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
ssn_iterator = None
|
|
16
|
+
product_iterator = None
|
|
18
17
|
if not isinstance(environment.runner, WorkerRunner):
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
product_reader = CSVReader("products.csv")
|
|
26
|
-
distributors["customers"] = Distributor(environment, ssn_reader, "customers")
|
|
27
|
-
distributors["products"] = Distributor(environment, product_reader, "products")
|
|
18
|
+
product_iterator = CSVReader("products.csv")
|
|
19
|
+
ssn_iterator = CSVDictReader("ssn.tsv", delimiter="\t")
|
|
20
|
+
# other readers work equally well
|
|
21
|
+
# ssn_reader = MongoLRUReader({"foo": "bar"}, "last_login")
|
|
22
|
+
distributors["products"] = Distributor(environment, product_iterator, "products")
|
|
23
|
+
distributors["customers"] = Distributor(environment, ssn_iterator, "customers")
|
|
28
24
|
|
|
29
25
|
|
|
30
26
|
class MyUser(HttpUser):
|
|
@@ -32,9 +28,9 @@ class MyUser(HttpUser):
|
|
|
32
28
|
|
|
33
29
|
@task
|
|
34
30
|
def my_task(self) -> None:
|
|
35
|
-
customer: Dict = next(distributors["customers"])
|
|
36
31
|
product: List[str] = next(distributors["products"])
|
|
37
|
-
|
|
32
|
+
customer: Dict = next(distributors["customers"])
|
|
33
|
+
self.client.get(f"/?product={product[0]}&customer={customer['ssn']}")
|
|
38
34
|
|
|
39
35
|
|
|
40
36
|
if __name__ == "__main__":
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import time
|
|
2
|
+
import typing
|
|
3
|
+
|
|
4
|
+
from locust import task, TaskSet
|
|
5
|
+
from locust_plugins.users.mqtt import MqttUser
|
|
6
|
+
from locust_plugins.users.mqtt import MqttClient
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
# extend the MqttClient class with your own custom implementation
|
|
10
|
+
class MyMqttClient(MqttClient):
|
|
11
|
+
|
|
12
|
+
# you can override the event name with your custom implementation
|
|
13
|
+
def _generate_event_name(self, event_type: str, qos: int, topic: str):
|
|
14
|
+
return f"mqtt:{event_type}:{qos}"
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class MyUser(MqttUser):
|
|
18
|
+
# override the client_cls with your custom MqttClient implementation
|
|
19
|
+
client_cls: typing.Type[MyMqttClient] = MyMqttClient
|
|
20
|
+
|
|
21
|
+
@task
|
|
22
|
+
class MyTasks(TaskSet):
|
|
23
|
+
# Sleep for a while to allow the client time to connect.
|
|
24
|
+
# This is probably not the most "correct" way to do this: a better method
|
|
25
|
+
# might be to add a gevent.event.Event to the MqttClient's on_connect
|
|
26
|
+
# callback and wait for that (with a timeout) here.
|
|
27
|
+
# However, this works well enough for the sake of an example.
|
|
28
|
+
def on_start(self):
|
|
29
|
+
time.sleep(5)
|
|
30
|
+
|
|
31
|
+
@task
|
|
32
|
+
def say_hello(self):
|
|
33
|
+
self.client.publish("hello/locust", b"hello world")
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
# Notes:
|
|
4
4
|
# Dont forget to first install the browsers by running: playwright install
|
|
5
5
|
# Browsers are heavy. Dont expect to be able to do as much load as usual with Locust. Optimize your tests by blocking requests for unnecessary resources.
|
|
6
|
-
# Dont run too many users per worker instance (or you'll get the dreaded "CPU usage over 90%" warning). Instead, scale using more Locust workers. 4-5 users/browsers per workers seems ok.
|
|
6
|
+
# Dont run too many users per worker instance (or you'll get the dreaded "CPU usage over 90%" warning). Instead, scale using more Locust workers. 4-5 users/browsers per workers seems ok.
|
|
7
7
|
# Some things, such as adding request callbacks (Page.route()), will cause intense communication with the browser will overload Python/Playwright so be careful.
|
|
8
8
|
# It is easy to accidentally make Playwright tests stall for a long time, for example if your page does finish loading completely (triggering the "load" event). Experiment with alternative wait strategies (e.g. wait_until="domcontentloaded" or self.page.wait_for_selector(...))
|
|
9
9
|
|
|
@@ -117,6 +117,9 @@ class MqttClient(mqtt.Client):
|
|
|
117
117
|
self._publish_requests: dict[int, PublishedMessageContext] = {}
|
|
118
118
|
self._subscribe_requests: dict[int, SubscribeContext] = {}
|
|
119
119
|
|
|
120
|
+
def _generate_event_name(self, event_type: str, qos: int, topic: str):
|
|
121
|
+
return _generate_mqtt_event_name(event_type, qos, topic)
|
|
122
|
+
|
|
120
123
|
def _on_publish_cb(
|
|
121
124
|
self,
|
|
122
125
|
client: mqtt.Client,
|
|
@@ -143,7 +146,7 @@ class MqttClient(mqtt.Client):
|
|
|
143
146
|
# fire successful publish event
|
|
144
147
|
self.environment.events.request.fire(
|
|
145
148
|
request_type=REQUEST_TYPE,
|
|
146
|
-
name=
|
|
149
|
+
name=self._generate_event_name("publish", request_context.qos, request_context.topic),
|
|
147
150
|
response_time=(cb_time - request_context.start_time) * 1000,
|
|
148
151
|
response_length=request_context.payload_size,
|
|
149
152
|
exception=None,
|
|
@@ -180,7 +183,7 @@ class MqttClient(mqtt.Client):
|
|
|
180
183
|
if SUBACK_FAILURE in granted_qos:
|
|
181
184
|
self.environment.events.request.fire(
|
|
182
185
|
request_type=REQUEST_TYPE,
|
|
183
|
-
name=
|
|
186
|
+
name=self._generate_event_name("subscribe", request_context.qos, request_context.topic),
|
|
184
187
|
response_time=(cb_time - request_context.start_time) * 1000,
|
|
185
188
|
response_length=0,
|
|
186
189
|
exception=AssertionError(f"Broker returned an error response during subscription: {granted_qos}"),
|
|
@@ -193,7 +196,7 @@ class MqttClient(mqtt.Client):
|
|
|
193
196
|
# fire successful subscribe event
|
|
194
197
|
self.environment.events.request.fire(
|
|
195
198
|
request_type=REQUEST_TYPE,
|
|
196
|
-
name=
|
|
199
|
+
name=self._generate_event_name("subscribe", request_context.qos, request_context.topic),
|
|
197
200
|
response_time=(cb_time - request_context.start_time) * 1000,
|
|
198
201
|
response_length=0,
|
|
199
202
|
exception=None,
|
|
@@ -287,7 +290,7 @@ class MqttClient(mqtt.Client):
|
|
|
287
290
|
if publish_info.rc != mqtt.MQTT_ERR_SUCCESS:
|
|
288
291
|
self.environment.events.request.fire(
|
|
289
292
|
request_type=REQUEST_TYPE,
|
|
290
|
-
name=
|
|
293
|
+
name=self._generate_event_name("publish", request_context.qos, request_context.topic),
|
|
291
294
|
response_time=0,
|
|
292
295
|
response_length=0,
|
|
293
296
|
exception=publish_info.rc,
|
|
@@ -325,7 +328,7 @@ class MqttClient(mqtt.Client):
|
|
|
325
328
|
if result != mqtt.MQTT_ERR_SUCCESS:
|
|
326
329
|
self.environment.events.request.fire(
|
|
327
330
|
request_type=REQUEST_TYPE,
|
|
328
|
-
name=
|
|
331
|
+
name=self._generate_event_name("subscribe", request_context.qos, request_context.topic),
|
|
329
332
|
response_time=0,
|
|
330
333
|
response_length=0,
|
|
331
334
|
exception=result,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{locust-plugins-4.3.3 → locust-plugins-4.4.0}/examples/transaction_example_as_library_local.py
RENAMED
|
File without changes
|
{locust-plugins-4.3.3 → locust-plugins-4.4.0}/examples/transaction_example_as_library_master.py
RENAMED
|
File without changes
|
{locust-plugins-4.3.3 → locust-plugins-4.4.0}/examples/transaction_example_as_library_worker.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{locust-plugins-4.3.3 → locust-plugins-4.4.0}/locust_plugins/dashboards/locust-grafana/Dockerfile
RENAMED
|
File without changes
|
{locust-plugins-4.3.3 → locust-plugins-4.4.0}/locust_plugins/dashboards/locust-grafana/Makefile
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{locust-plugins-4.3.3 → locust-plugins-4.4.0}/locust_plugins/dashboards/locust-timescale/Dockerfile
RENAMED
|
File without changes
|
{locust-plugins-4.3.3 → locust-plugins-4.4.0}/locust_plugins/dashboards/locust-timescale/Makefile
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{locust-plugins-4.3.3 → locust-plugins-4.4.0}/locust_plugins/dashboards/screenshots/scatter_plot.png
RENAMED
|
File without changes
|
{locust-plugins-4.3.3 → locust-plugins-4.4.0}/locust_plugins/dashboards/screenshots/testruns.png
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|