locust 2.31.6.dev25__tar.gz → 2.31.7__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.
Files changed (55) hide show
  1. {locust-2.31.6.dev25 → locust-2.31.7}/PKG-INFO +1 -1
  2. {locust-2.31.6.dev25 → locust-2.31.7}/locust/_version.py +2 -2
  3. {locust-2.31.6.dev25 → locust-2.31.7}/locust/argument_parser.py +6 -0
  4. locust-2.31.7/locust/contrib/mongodb.py +41 -0
  5. {locust-2.31.6.dev25 → locust-2.31.7}/locust/main.py +4 -2
  6. {locust-2.31.6.dev25 → locust-2.31.7}/locust/web.py +11 -5
  7. locust-2.31.7/locust/webui/dist/assets/index-sZjNzlO0.js +221 -0
  8. {locust-2.31.6.dev25 → locust-2.31.7}/locust/webui/dist/auth.html +1 -1
  9. {locust-2.31.6.dev25 → locust-2.31.7}/locust/webui/dist/index.html +1 -1
  10. locust-2.31.7/locust/webui/dist/report.html +236 -0
  11. {locust-2.31.6.dev25 → locust-2.31.7}/poetry.lock +308 -279
  12. {locust-2.31.6.dev25 → locust-2.31.7}/pyproject.toml +2 -2
  13. locust-2.31.6.dev25/locust/webui/dist/assets/index-DQd3Odi5.js +0 -234
  14. locust-2.31.6.dev25/locust/webui/dist/report.html +0 -249
  15. {locust-2.31.6.dev25 → locust-2.31.7}/LICENSE +0 -0
  16. {locust-2.31.6.dev25 → locust-2.31.7}/README.md +0 -0
  17. {locust-2.31.6.dev25 → locust-2.31.7}/locust/__init__.py +0 -0
  18. {locust-2.31.6.dev25 → locust-2.31.7}/locust/__main__.py +0 -0
  19. {locust-2.31.6.dev25 → locust-2.31.7}/locust/clients.py +0 -0
  20. {locust-2.31.6.dev25 → locust-2.31.7}/locust/contrib/__init__.py +0 -0
  21. {locust-2.31.6.dev25 → locust-2.31.7}/locust/contrib/fasthttp.py +0 -0
  22. {locust-2.31.6.dev25 → locust-2.31.7}/locust/contrib/postgres.py +0 -0
  23. {locust-2.31.6.dev25 → locust-2.31.7}/locust/debug.py +0 -0
  24. {locust-2.31.6.dev25 → locust-2.31.7}/locust/dispatch.py +0 -0
  25. {locust-2.31.6.dev25 → locust-2.31.7}/locust/env.py +0 -0
  26. {locust-2.31.6.dev25 → locust-2.31.7}/locust/event.py +0 -0
  27. {locust-2.31.6.dev25 → locust-2.31.7}/locust/exception.py +0 -0
  28. {locust-2.31.6.dev25 → locust-2.31.7}/locust/html.py +0 -0
  29. {locust-2.31.6.dev25 → locust-2.31.7}/locust/input_events.py +0 -0
  30. {locust-2.31.6.dev25 → locust-2.31.7}/locust/log.py +0 -0
  31. {locust-2.31.6.dev25 → locust-2.31.7}/locust/py.typed +0 -0
  32. {locust-2.31.6.dev25 → locust-2.31.7}/locust/rpc/__init__.py +0 -0
  33. {locust-2.31.6.dev25 → locust-2.31.7}/locust/rpc/protocol.py +0 -0
  34. {locust-2.31.6.dev25 → locust-2.31.7}/locust/rpc/zmqrpc.py +0 -0
  35. {locust-2.31.6.dev25 → locust-2.31.7}/locust/runners.py +0 -0
  36. {locust-2.31.6.dev25 → locust-2.31.7}/locust/shape.py +0 -0
  37. {locust-2.31.6.dev25 → locust-2.31.7}/locust/stats.py +0 -0
  38. {locust-2.31.6.dev25 → locust-2.31.7}/locust/user/__init__.py +0 -0
  39. {locust-2.31.6.dev25 → locust-2.31.7}/locust/user/inspectuser.py +0 -0
  40. {locust-2.31.6.dev25 → locust-2.31.7}/locust/user/sequential_taskset.py +0 -0
  41. {locust-2.31.6.dev25 → locust-2.31.7}/locust/user/task.py +0 -0
  42. {locust-2.31.6.dev25 → locust-2.31.7}/locust/user/users.py +0 -0
  43. {locust-2.31.6.dev25 → locust-2.31.7}/locust/user/wait_time.py +0 -0
  44. {locust-2.31.6.dev25 → locust-2.31.7}/locust/util/__init__.py +0 -0
  45. {locust-2.31.6.dev25 → locust-2.31.7}/locust/util/cache.py +0 -0
  46. {locust-2.31.6.dev25 → locust-2.31.7}/locust/util/date.py +0 -0
  47. {locust-2.31.6.dev25 → locust-2.31.7}/locust/util/deprecation.py +0 -0
  48. {locust-2.31.6.dev25 → locust-2.31.7}/locust/util/directory.py +0 -0
  49. {locust-2.31.6.dev25 → locust-2.31.7}/locust/util/exception_handler.py +0 -0
  50. {locust-2.31.6.dev25 → locust-2.31.7}/locust/util/load_locustfile.py +0 -0
  51. {locust-2.31.6.dev25 → locust-2.31.7}/locust/util/rounding.py +0 -0
  52. {locust-2.31.6.dev25 → locust-2.31.7}/locust/util/timespan.py +0 -0
  53. {locust-2.31.6.dev25 → locust-2.31.7}/locust/util/url.py +0 -0
  54. {locust-2.31.6.dev25 → locust-2.31.7}/locust/webui/dist/assets/favicon-dark.png +0 -0
  55. {locust-2.31.6.dev25 → locust-2.31.7}/locust/webui/dist/assets/favicon-light.png +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: locust
3
- Version: 2.31.6.dev25
3
+ Version: 2.31.7
4
4
  Summary: Developer-friendly load testing framework
5
5
  Home-page: https://locust.io/
6
6
  License: MIT
@@ -14,7 +14,7 @@ __version_tuple__: VERSION_TUPLE
14
14
  version_tuple: VERSION_TUPLE
15
15
 
16
16
 
17
- __version__ = "2.31.6.dev25"
17
+ __version__ = "2.31.7"
18
18
  version = __version__
19
- __version_tuple__ = (2, 31, 6, "dev25")
19
+ __version_tuple__ = (2, 31, 7)
20
20
  version_tuple = __version_tuple__
@@ -424,6 +424,12 @@ def setup_parser_arguments(parser):
424
424
  help="Host to bind the web interface to. Defaults to '*' (all interfaces)",
425
425
  env_var="LOCUST_WEB_HOST",
426
426
  )
427
+ web_ui_group.add_argument(
428
+ "--web-host-display-name",
429
+ type=str,
430
+ help=configargparse.SUPPRESS,
431
+ env_var="LOCUST_WEB_HOST_DISPLAY_NAME",
432
+ )
427
433
  web_ui_group.add_argument(
428
434
  "--web-port",
429
435
  "-P",
@@ -0,0 +1,41 @@
1
+ from locust import User, events
2
+
3
+ import time
4
+
5
+ from pymongo import MongoClient
6
+ from pymongo.errors import PyMongoError
7
+
8
+
9
+ class MongoDBClient(MongoClient):
10
+ def __init__(self, conn_string, db_name):
11
+ super().__init__(conn_string)
12
+ self.db = self.client[db_name]
13
+
14
+ def execute_query(self, collection_name, query):
15
+ start_time = time.time()
16
+ try:
17
+ collection = self.db[collection_name]
18
+ collection.find(query)
19
+
20
+ response_time = int((time.time() - start_time) * 1000)
21
+ events.request.fire(request_type="MONGODB", name="QUERY", response_time=response_time, response_length=0)
22
+ except PyMongoError as e:
23
+ response_time = int((time.time() - start_time) * 1000)
24
+ events.request.fire(
25
+ request_type="MONGODB",
26
+ name="QUERY",
27
+ response_time=response_time,
28
+ response_length=0,
29
+ exception=e,
30
+ )
31
+
32
+
33
+ class MongoDBUser(User):
34
+ abstract = True
35
+
36
+ def __init__(self, *args, **kwargs):
37
+ super().__init__(*args, **kwargs)
38
+ self.client = MongoDBClient(conn_string=self.conn_string, db_name=self.db_name)
39
+
40
+ def on_stop(self):
41
+ self.client.close()
@@ -199,6 +199,8 @@ def main():
199
199
  sys.exit(1)
200
200
 
201
201
  children = []
202
+ logger = logging.getLogger(__name__)
203
+ logger.info(f"Starting Locust {version}")
202
204
 
203
205
  if options.processes:
204
206
  if os.name == "nt":
@@ -298,7 +300,6 @@ def main():
298
300
 
299
301
  atexit.register(kill_workers, children)
300
302
 
301
- logger = logging.getLogger(__name__)
302
303
  greenlet_exception_handler = greenlet_exception_logger(logger)
303
304
 
304
305
  if options.stop_timeout:
@@ -486,6 +487,8 @@ See https://github.com/locustio/locust/wiki/Installation#increasing-maximum-numb
486
487
  web_host = options.web_host
487
488
  if web_host:
488
489
  logger.info(f"Starting web interface at {protocol}://{web_host}:{options.web_port}")
490
+ if options.web_host_display_name:
491
+ logger.info(f"Starting web interface at {options.web_host_display_name}")
489
492
  else:
490
493
  if os.name == "nt":
491
494
  logger.info(
@@ -686,7 +689,6 @@ See https://github.com/locustio/locust/wiki/Installation#increasing-maximum-numb
686
689
  gevent.signal_handler(signal.SIGTERM, sig_term_handler)
687
690
 
688
691
  try:
689
- logger.info(f"Starting Locust {version}")
690
692
  if options.class_picker:
691
693
  logger.info("Locust is running with the UserClass Picker Enabled")
692
694
  if options.autostart and not options.headless:
@@ -135,6 +135,11 @@ class WebUI:
135
135
  # ensures static js files work on Windows
136
136
  mimetypes.add_type("application/javascript", ".js")
137
137
 
138
+ if self.web_login:
139
+ self._login_manager = LoginManager()
140
+ self._login_manager.init_app(self.app)
141
+ self._login_manager.login_view = "login"
142
+
138
143
  if environment.runner:
139
144
  self.update_template_args()
140
145
  if not delayed_start:
@@ -145,7 +150,7 @@ class WebUI:
145
150
  error_message = str(error)
146
151
  error_code = getattr(error, "code", 500)
147
152
  logger.log(
148
- logging.INFO if error_code <= 404 else logging.ERROR,
153
+ logging.DEBUG if error_code <= 404 else logging.ERROR,
149
154
  f"UI got request for {request.path}, but it resulted in a {error_code}: {error.name}",
150
155
  )
151
156
  return make_response(error_message, error_code)
@@ -516,13 +521,14 @@ class WebUI:
516
521
  @property
517
522
  def login_manager(self):
518
523
  if self.web_login:
519
- login_manager = LoginManager()
520
- login_manager.init_app(self.app)
521
- login_manager.login_view = "login"
522
- return login_manager
524
+ return self._login_manager
523
525
 
524
526
  raise AttributeError("The login_manager is only available with --web-login.\n")
525
527
 
528
+ @login_manager.setter
529
+ def login_manager(self, value):
530
+ self._login_manager = value
531
+
526
532
  def start(self):
527
533
  self.greenlet = gevent.spawn(self.start_server)
528
534
  self.greenlet.link_exception(greenlet_exception_handler)