locust 2.43.4.dev19__tar.gz → 2.43.4.dev31__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-2.43.4.dev19 → locust-2.43.4.dev31}/PKG-INFO +1 -1
- {locust-2.43.4.dev19 → locust-2.43.4.dev31}/locust/_version.py +2 -2
- {locust-2.43.4.dev19 → locust-2.43.4.dev31}/locust/stats.py +22 -8
- {locust-2.43.4.dev19 → locust-2.43.4.dev31}/locust/user/task.py +2 -1
- {locust-2.43.4.dev19 → locust-2.43.4.dev31}/locust/user/users.py +2 -1
- {locust-2.43.4.dev19 → locust-2.43.4.dev31}/locust/user/wait_time.py +11 -8
- {locust-2.43.4.dev19 → locust-2.43.4.dev31}/.gitignore +0 -0
- {locust-2.43.4.dev19 → locust-2.43.4.dev31}/LICENSE +0 -0
- {locust-2.43.4.dev19 → locust-2.43.4.dev31}/README.md +0 -0
- {locust-2.43.4.dev19 → locust-2.43.4.dev31}/hatch_build.py +0 -0
- {locust-2.43.4.dev19 → locust-2.43.4.dev31}/locust/__init__.py +0 -0
- {locust-2.43.4.dev19 → locust-2.43.4.dev31}/locust/__main__.py +0 -0
- {locust-2.43.4.dev19 → locust-2.43.4.dev31}/locust/argument_parser.py +0 -0
- {locust-2.43.4.dev19 → locust-2.43.4.dev31}/locust/clients.py +0 -0
- {locust-2.43.4.dev19 → locust-2.43.4.dev31}/locust/contrib/__init__.py +0 -0
- {locust-2.43.4.dev19 → locust-2.43.4.dev31}/locust/contrib/dns.py +0 -0
- {locust-2.43.4.dev19 → locust-2.43.4.dev31}/locust/contrib/fasthttp.py +0 -0
- {locust-2.43.4.dev19 → locust-2.43.4.dev31}/locust/contrib/milvus.py +0 -0
- {locust-2.43.4.dev19 → locust-2.43.4.dev31}/locust/contrib/mongodb.py +0 -0
- {locust-2.43.4.dev19 → locust-2.43.4.dev31}/locust/contrib/mqtt.py +0 -0
- {locust-2.43.4.dev19 → locust-2.43.4.dev31}/locust/contrib/oai.py +0 -0
- {locust-2.43.4.dev19 → locust-2.43.4.dev31}/locust/contrib/postgres.py +0 -0
- {locust-2.43.4.dev19 → locust-2.43.4.dev31}/locust/contrib/qdrant.py +0 -0
- {locust-2.43.4.dev19 → locust-2.43.4.dev31}/locust/contrib/socketio.py +0 -0
- {locust-2.43.4.dev19 → locust-2.43.4.dev31}/locust/debug.py +0 -0
- {locust-2.43.4.dev19 → locust-2.43.4.dev31}/locust/dispatch.py +0 -0
- {locust-2.43.4.dev19 → locust-2.43.4.dev31}/locust/env.py +0 -0
- {locust-2.43.4.dev19 → locust-2.43.4.dev31}/locust/event.py +0 -0
- {locust-2.43.4.dev19 → locust-2.43.4.dev31}/locust/exception.py +0 -0
- {locust-2.43.4.dev19 → locust-2.43.4.dev31}/locust/html.py +0 -0
- {locust-2.43.4.dev19 → locust-2.43.4.dev31}/locust/input_events.py +0 -0
- {locust-2.43.4.dev19 → locust-2.43.4.dev31}/locust/log.py +0 -0
- {locust-2.43.4.dev19 → locust-2.43.4.dev31}/locust/main.py +0 -0
- {locust-2.43.4.dev19 → locust-2.43.4.dev31}/locust/opentelemetry.py +0 -0
- {locust-2.43.4.dev19 → locust-2.43.4.dev31}/locust/py.typed +0 -0
- {locust-2.43.4.dev19 → locust-2.43.4.dev31}/locust/rpc/__init__.py +0 -0
- {locust-2.43.4.dev19 → locust-2.43.4.dev31}/locust/rpc/protocol.py +0 -0
- {locust-2.43.4.dev19 → locust-2.43.4.dev31}/locust/rpc/zmqrpc.py +0 -0
- {locust-2.43.4.dev19 → locust-2.43.4.dev31}/locust/runners.py +0 -0
- {locust-2.43.4.dev19 → locust-2.43.4.dev31}/locust/shape.py +0 -0
- {locust-2.43.4.dev19 → locust-2.43.4.dev31}/locust/user/__init__.py +0 -0
- {locust-2.43.4.dev19 → locust-2.43.4.dev31}/locust/user/inspectuser.py +0 -0
- {locust-2.43.4.dev19 → locust-2.43.4.dev31}/locust/user/markov_taskset.py +0 -0
- {locust-2.43.4.dev19 → locust-2.43.4.dev31}/locust/user/sequential_taskset.py +0 -0
- {locust-2.43.4.dev19 → locust-2.43.4.dev31}/locust/util/__init__.py +0 -0
- {locust-2.43.4.dev19 → locust-2.43.4.dev31}/locust/util/cache.py +0 -0
- {locust-2.43.4.dev19 → locust-2.43.4.dev31}/locust/util/date.py +0 -0
- {locust-2.43.4.dev19 → locust-2.43.4.dev31}/locust/util/deprecation.py +0 -0
- {locust-2.43.4.dev19 → locust-2.43.4.dev31}/locust/util/directory.py +0 -0
- {locust-2.43.4.dev19 → locust-2.43.4.dev31}/locust/util/exception_handler.py +0 -0
- {locust-2.43.4.dev19 → locust-2.43.4.dev31}/locust/util/load_locustfile.py +0 -0
- {locust-2.43.4.dev19 → locust-2.43.4.dev31}/locust/util/rounding.py +0 -0
- {locust-2.43.4.dev19 → locust-2.43.4.dev31}/locust/util/timespan.py +0 -0
- {locust-2.43.4.dev19 → locust-2.43.4.dev31}/locust/util/url.py +0 -0
- {locust-2.43.4.dev19 → locust-2.43.4.dev31}/locust/web.py +0 -0
- {locust-2.43.4.dev19 → locust-2.43.4.dev31}/locust/webui/dist/assets/favicon-dark.png +0 -0
- {locust-2.43.4.dev19 → locust-2.43.4.dev31}/locust/webui/dist/assets/favicon-light.png +0 -0
- {locust-2.43.4.dev19 → locust-2.43.4.dev31}/locust/webui/dist/assets/graphs-dark.png +0 -0
- {locust-2.43.4.dev19 → locust-2.43.4.dev31}/locust/webui/dist/assets/graphs-light.png +0 -0
- {locust-2.43.4.dev19 → locust-2.43.4.dev31}/locust/webui/dist/assets/index-Bl8icIRq.js +0 -0
- {locust-2.43.4.dev19 → locust-2.43.4.dev31}/locust/webui/dist/assets/terminal.gif +0 -0
- {locust-2.43.4.dev19 → locust-2.43.4.dev31}/locust/webui/dist/assets/testruns-dark.png +0 -0
- {locust-2.43.4.dev19 → locust-2.43.4.dev31}/locust/webui/dist/assets/testruns-light.png +0 -0
- {locust-2.43.4.dev19 → locust-2.43.4.dev31}/locust/webui/dist/auth.html +0 -0
- {locust-2.43.4.dev19 → locust-2.43.4.dev31}/locust/webui/dist/index.html +0 -0
- {locust-2.43.4.dev19 → locust-2.43.4.dev31}/locust/webui/dist/report.html +0 -0
- {locust-2.43.4.dev19 → locust-2.43.4.dev31}/pyproject.toml +0 -0
- {locust-2.43.4.dev19 → locust-2.43.4.dev31}/pytest_locust/plugin.py +0 -0
|
@@ -28,7 +28,7 @@ version_tuple: VERSION_TUPLE
|
|
|
28
28
|
commit_id: COMMIT_ID
|
|
29
29
|
__commit_id__: COMMIT_ID
|
|
30
30
|
|
|
31
|
-
__version__ = version = '2.43.4.
|
|
32
|
-
__version_tuple__ = version_tuple = (2, 43, 4, '
|
|
31
|
+
__version__ = version = '2.43.4.dev31'
|
|
32
|
+
__version_tuple__ = version_tuple = (2, 43, 4, 'dev31')
|
|
33
33
|
|
|
34
34
|
__commit_id__ = commit_id = None
|
|
@@ -119,6 +119,27 @@ PERCENTILES_TO_STATISTICS = [0.95, 0.99]
|
|
|
119
119
|
PERCENTILES_TO_CHART = [0.5, 0.95]
|
|
120
120
|
|
|
121
121
|
|
|
122
|
+
def bucket_response_time(response_time: int | float) -> int:
|
|
123
|
+
"""Round response time to reduce unique histogram keys.
|
|
124
|
+
|
|
125
|
+
Rounds to ~2 significant digits, so that 147 becomes 150, 3432 becomes 3400
|
|
126
|
+
and 58760 becomes 59000. This limits the dict to ~310 unique keys, which is
|
|
127
|
+
important for bandwidth in distributed mode.
|
|
128
|
+
|
|
129
|
+
This is a module-level function so it can be replaced at runtime for custom
|
|
130
|
+
bucketing, e.g. rounding to 3 significant figures or using fixed-width bins.
|
|
131
|
+
See :ref:`customizing-response-time-bucketing` in the docs.
|
|
132
|
+
"""
|
|
133
|
+
if response_time < 100:
|
|
134
|
+
return round(response_time)
|
|
135
|
+
elif response_time < 1000:
|
|
136
|
+
return int(round(response_time, -1))
|
|
137
|
+
elif response_time < 10000:
|
|
138
|
+
return int(round(response_time, -2))
|
|
139
|
+
else:
|
|
140
|
+
return int(round(response_time, -3))
|
|
141
|
+
|
|
142
|
+
|
|
122
143
|
class RequestStatsAdditionError(Exception):
|
|
123
144
|
pass
|
|
124
145
|
|
|
@@ -381,14 +402,7 @@ class StatsEntry:
|
|
|
381
402
|
# to avoid to much data that has to be transferred to the master node when
|
|
382
403
|
# running in distributed mode, we save the response time rounded in a dict
|
|
383
404
|
# so that 147 becomes 150, 3432 becomes 3400 and 58760 becomes 59000
|
|
384
|
-
|
|
385
|
-
rounded_response_time = round(response_time)
|
|
386
|
-
elif response_time < 1000:
|
|
387
|
-
rounded_response_time = round(response_time, -1)
|
|
388
|
-
elif response_time < 10000:
|
|
389
|
-
rounded_response_time = round(response_time, -2)
|
|
390
|
-
else:
|
|
391
|
-
rounded_response_time = round(response_time, -3)
|
|
405
|
+
rounded_response_time = bucket_response_time(response_time)
|
|
392
406
|
|
|
393
407
|
# increase request count for the rounded key in response time dict
|
|
394
408
|
self.response_times[rounded_response_time] += 1
|
|
@@ -316,7 +316,8 @@ class TaskSet(metaclass=TaskSetMeta):
|
|
|
316
316
|
self.max_wait = self.user.max_wait
|
|
317
317
|
if not self.wait_function:
|
|
318
318
|
self.wait_function = self.user.wait_function
|
|
319
|
-
self._cp_last_run = time() # used by constant_pacing wait_time
|
|
319
|
+
self._cp_last_run: float = time() # used by constant_pacing wait_time
|
|
320
|
+
self._cp_last_wait_time: float = 0 # used by constant_pacing wait_time
|
|
320
321
|
|
|
321
322
|
@property
|
|
322
323
|
def user(self) -> User:
|
|
@@ -136,7 +136,8 @@ class User(metaclass=UserMeta):
|
|
|
136
136
|
self._greenlet: greenlet.Greenlet | None = None
|
|
137
137
|
self._group: Group
|
|
138
138
|
self._taskset_instance: TaskSet | None = None
|
|
139
|
-
self._cp_last_run = time.time() # used by constant_pacing wait_time
|
|
139
|
+
self._cp_last_run: float = time.time() # used by constant_pacing wait_time
|
|
140
|
+
self._cp_last_wait_time: float = 0 # used by constant_pacing wait_time
|
|
140
141
|
|
|
141
142
|
def on_start(self) -> None:
|
|
142
143
|
"""
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import random
|
|
2
|
+
from collections.abc import Callable
|
|
2
3
|
from time import time
|
|
4
|
+
from typing import TYPE_CHECKING
|
|
3
5
|
|
|
6
|
+
if TYPE_CHECKING:
|
|
7
|
+
from locust import User
|
|
4
8
|
|
|
5
|
-
|
|
9
|
+
|
|
10
|
+
def between(min_wait: float, max_wait: float) -> Callable[["User"], float]:
|
|
6
11
|
"""
|
|
7
12
|
Returns a function that will return a random number between min_wait and max_wait.
|
|
8
13
|
|
|
@@ -15,7 +20,7 @@ def between(min_wait, max_wait):
|
|
|
15
20
|
return lambda instance: min_wait + random.random() * (max_wait - min_wait)
|
|
16
21
|
|
|
17
22
|
|
|
18
|
-
def constant(wait_time):
|
|
23
|
+
def constant(wait_time: float) -> Callable[["User"], float]:
|
|
19
24
|
"""
|
|
20
25
|
Returns a function that just returns the number specified by the wait_time argument
|
|
21
26
|
|
|
@@ -27,7 +32,7 @@ def constant(wait_time):
|
|
|
27
32
|
return lambda instance: wait_time
|
|
28
33
|
|
|
29
34
|
|
|
30
|
-
def constant_pacing(wait_time):
|
|
35
|
+
def constant_pacing(wait_time: float) -> Callable[["User"], float]:
|
|
31
36
|
"""
|
|
32
37
|
Returns a function that will track the run time of the tasks, and for each time it's
|
|
33
38
|
called it will return a wait time that will try to make the total time between task
|
|
@@ -46,10 +51,8 @@ def constant_pacing(wait_time):
|
|
|
46
51
|
the next task.
|
|
47
52
|
"""
|
|
48
53
|
|
|
49
|
-
def wait_time_func(self):
|
|
50
|
-
|
|
51
|
-
self._cp_last_wait_time = 0
|
|
52
|
-
run_time = time() - self._cp_last_run - self._cp_last_wait_time
|
|
54
|
+
def wait_time_func(self: "User") -> float:
|
|
55
|
+
run_time: float = time() - self._cp_last_run - self._cp_last_wait_time
|
|
53
56
|
self._cp_last_wait_time = max(0, wait_time - run_time)
|
|
54
57
|
self._cp_last_run = time()
|
|
55
58
|
return self._cp_last_wait_time
|
|
@@ -57,7 +60,7 @@ def constant_pacing(wait_time):
|
|
|
57
60
|
return wait_time_func
|
|
58
61
|
|
|
59
62
|
|
|
60
|
-
def constant_throughput(task_runs_per_second):
|
|
63
|
+
def constant_throughput(task_runs_per_second: float) -> Callable[["User"], float]:
|
|
61
64
|
"""
|
|
62
65
|
Returns a function that will track the run time of the tasks, and for each time it's
|
|
63
66
|
called it will return a wait time that will try to make the number of task runs per second
|
|
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
|
|
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
|