django-cfg 1.4.62__py3-none-any.whl → 1.4.64__py3-none-any.whl

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.

Potentially problematic release.


This version of django-cfg might be problematic. Click here for more details.

Files changed (181) hide show
  1. django_cfg/__init__.py +1 -1
  2. django_cfg/apps/accounts/services/otp_service.py +3 -14
  3. django_cfg/apps/centrifugo/__init__.py +57 -0
  4. django_cfg/apps/centrifugo/admin/__init__.py +13 -0
  5. django_cfg/apps/centrifugo/admin/centrifugo_log.py +249 -0
  6. django_cfg/apps/centrifugo/admin/config.py +82 -0
  7. django_cfg/apps/centrifugo/apps.py +31 -0
  8. django_cfg/apps/centrifugo/codegen/IMPLEMENTATION_SUMMARY.md +475 -0
  9. django_cfg/apps/centrifugo/codegen/README.md +242 -0
  10. django_cfg/apps/centrifugo/codegen/USAGE.md +616 -0
  11. django_cfg/apps/centrifugo/codegen/__init__.py +19 -0
  12. django_cfg/apps/centrifugo/codegen/discovery.py +246 -0
  13. django_cfg/apps/centrifugo/codegen/generators/go_thin/__init__.py +5 -0
  14. django_cfg/apps/centrifugo/codegen/generators/go_thin/generator.py +174 -0
  15. django_cfg/apps/centrifugo/codegen/generators/go_thin/templates/README.md.j2 +182 -0
  16. django_cfg/apps/centrifugo/codegen/generators/go_thin/templates/client.go.j2 +64 -0
  17. django_cfg/apps/centrifugo/codegen/generators/go_thin/templates/go.mod.j2 +10 -0
  18. django_cfg/apps/centrifugo/codegen/generators/go_thin/templates/rpc_client.go.j2 +300 -0
  19. django_cfg/apps/centrifugo/codegen/generators/go_thin/templates/rpc_client.go.j2.old +267 -0
  20. django_cfg/apps/centrifugo/codegen/generators/go_thin/templates/types.go.j2 +16 -0
  21. django_cfg/apps/centrifugo/codegen/generators/python_thin/__init__.py +7 -0
  22. django_cfg/apps/centrifugo/codegen/generators/python_thin/generator.py +241 -0
  23. django_cfg/apps/centrifugo/codegen/generators/python_thin/templates/README.md.j2 +128 -0
  24. django_cfg/apps/centrifugo/codegen/generators/python_thin/templates/__init__.py.j2 +22 -0
  25. django_cfg/apps/centrifugo/codegen/generators/python_thin/templates/client.py.j2 +73 -0
  26. django_cfg/apps/centrifugo/codegen/generators/python_thin/templates/models.py.j2 +19 -0
  27. django_cfg/apps/centrifugo/codegen/generators/python_thin/templates/requirements.txt.j2 +8 -0
  28. django_cfg/apps/centrifugo/codegen/generators/python_thin/templates/rpc_client.py.j2 +193 -0
  29. django_cfg/apps/centrifugo/codegen/generators/typescript_thin/__init__.py +5 -0
  30. django_cfg/apps/centrifugo/codegen/generators/typescript_thin/generator.py +124 -0
  31. django_cfg/apps/centrifugo/codegen/generators/typescript_thin/templates/README.md.j2 +38 -0
  32. django_cfg/apps/centrifugo/codegen/generators/typescript_thin/templates/client.ts.j2 +25 -0
  33. django_cfg/apps/centrifugo/codegen/generators/typescript_thin/templates/index.ts.j2 +12 -0
  34. django_cfg/apps/centrifugo/codegen/generators/typescript_thin/templates/package.json.j2 +13 -0
  35. django_cfg/apps/centrifugo/codegen/generators/typescript_thin/templates/rpc-client.ts.j2 +137 -0
  36. django_cfg/apps/centrifugo/codegen/generators/typescript_thin/templates/tsconfig.json.j2 +14 -0
  37. django_cfg/apps/centrifugo/codegen/generators/typescript_thin/templates/types.ts.j2 +9 -0
  38. django_cfg/apps/centrifugo/codegen/utils/__init__.py +37 -0
  39. django_cfg/apps/centrifugo/codegen/utils/naming.py +155 -0
  40. django_cfg/apps/centrifugo/codegen/utils/type_converter.py +349 -0
  41. django_cfg/apps/centrifugo/decorators.py +137 -0
  42. django_cfg/apps/centrifugo/management/__init__.py +1 -0
  43. django_cfg/apps/centrifugo/management/commands/__init__.py +1 -0
  44. django_cfg/apps/centrifugo/management/commands/generate_centrifugo_clients.py +254 -0
  45. django_cfg/apps/centrifugo/managers/__init__.py +12 -0
  46. django_cfg/apps/centrifugo/managers/centrifugo_log.py +264 -0
  47. django_cfg/apps/centrifugo/migrations/0001_initial.py +164 -0
  48. django_cfg/apps/centrifugo/migrations/__init__.py +3 -0
  49. django_cfg/apps/centrifugo/models/__init__.py +11 -0
  50. django_cfg/apps/centrifugo/models/centrifugo_log.py +210 -0
  51. django_cfg/apps/centrifugo/registry.py +106 -0
  52. django_cfg/apps/centrifugo/router.py +125 -0
  53. django_cfg/apps/centrifugo/serializers/__init__.py +40 -0
  54. django_cfg/apps/centrifugo/serializers/admin_api.py +264 -0
  55. django_cfg/apps/centrifugo/serializers/channels.py +26 -0
  56. django_cfg/apps/centrifugo/serializers/health.py +17 -0
  57. django_cfg/apps/centrifugo/serializers/publishes.py +16 -0
  58. django_cfg/apps/centrifugo/serializers/stats.py +21 -0
  59. django_cfg/apps/centrifugo/services/__init__.py +12 -0
  60. django_cfg/apps/centrifugo/services/client/__init__.py +29 -0
  61. django_cfg/apps/centrifugo/services/client/client.py +582 -0
  62. django_cfg/apps/centrifugo/services/client/config.py +236 -0
  63. django_cfg/apps/centrifugo/services/client/exceptions.py +212 -0
  64. django_cfg/apps/centrifugo/services/config_helper.py +63 -0
  65. django_cfg/apps/centrifugo/services/dashboard_notifier.py +157 -0
  66. django_cfg/apps/centrifugo/services/logging.py +677 -0
  67. django_cfg/apps/centrifugo/static/django_cfg_centrifugo/css/dashboard.css +260 -0
  68. django_cfg/apps/centrifugo/static/django_cfg_centrifugo/js/dashboard/live_channels.mjs +313 -0
  69. django_cfg/apps/centrifugo/static/django_cfg_centrifugo/js/dashboard/live_testing.mjs +803 -0
  70. django_cfg/apps/centrifugo/static/django_cfg_centrifugo/js/dashboard/main.mjs +333 -0
  71. django_cfg/apps/centrifugo/static/django_cfg_centrifugo/js/dashboard/overview.mjs +432 -0
  72. django_cfg/apps/centrifugo/static/django_cfg_centrifugo/js/dashboard/testing.mjs +33 -0
  73. django_cfg/apps/centrifugo/static/django_cfg_centrifugo/js/dashboard/websocket.mjs +210 -0
  74. django_cfg/apps/centrifugo/templates/django_cfg_centrifugo/components/channels_content.html +46 -0
  75. django_cfg/apps/centrifugo/templates/django_cfg_centrifugo/components/live_channels_content.html +123 -0
  76. django_cfg/apps/centrifugo/templates/django_cfg_centrifugo/components/overview_content.html +45 -0
  77. django_cfg/apps/centrifugo/templates/django_cfg_centrifugo/components/publishes_content.html +84 -0
  78. django_cfg/apps/{ipc/templates/django_cfg_ipc → centrifugo/templates/django_cfg_centrifugo}/components/stat_cards.html +23 -20
  79. django_cfg/apps/centrifugo/templates/django_cfg_centrifugo/components/system_status.html +91 -0
  80. django_cfg/apps/{ipc/templates/django_cfg_ipc → centrifugo/templates/django_cfg_centrifugo}/components/tab_navigation.html +15 -15
  81. django_cfg/apps/centrifugo/templates/django_cfg_centrifugo/components/testing_tools.html +415 -0
  82. django_cfg/apps/centrifugo/templates/django_cfg_centrifugo/layout/base.html +61 -0
  83. django_cfg/apps/centrifugo/templates/django_cfg_centrifugo/pages/dashboard.html +58 -0
  84. django_cfg/apps/centrifugo/templates/django_cfg_centrifugo/tags/connection_script.html +48 -0
  85. django_cfg/apps/centrifugo/templatetags/__init__.py +1 -0
  86. django_cfg/apps/centrifugo/templatetags/centrifugo_tags.py +81 -0
  87. django_cfg/apps/centrifugo/urls.py +31 -0
  88. django_cfg/apps/{ipc → centrifugo}/urls_admin.py +4 -4
  89. django_cfg/apps/centrifugo/views/__init__.py +15 -0
  90. django_cfg/apps/centrifugo/views/admin_api.py +380 -0
  91. django_cfg/apps/centrifugo/views/dashboard.py +15 -0
  92. django_cfg/apps/centrifugo/views/monitoring.py +286 -0
  93. django_cfg/apps/centrifugo/views/testing_api.py +422 -0
  94. django_cfg/apps/support/utils/support_email_service.py +5 -18
  95. django_cfg/apps/tasks/templates/tasks/layout/base.html +0 -2
  96. django_cfg/apps/urls.py +5 -5
  97. django_cfg/core/base/config_model.py +4 -44
  98. django_cfg/core/builders/apps_builder.py +2 -2
  99. django_cfg/core/generation/integration_generators/third_party.py +8 -8
  100. django_cfg/core/utils/__init__.py +5 -0
  101. django_cfg/core/utils/url_helpers.py +73 -0
  102. django_cfg/modules/base.py +7 -7
  103. django_cfg/modules/django_client/core/__init__.py +2 -1
  104. django_cfg/modules/django_client/core/config/config.py +8 -0
  105. django_cfg/modules/django_client/core/generator/__init__.py +42 -2
  106. django_cfg/modules/django_client/core/generator/go/__init__.py +14 -0
  107. django_cfg/modules/django_client/core/generator/go/client_generator.py +124 -0
  108. django_cfg/modules/django_client/core/generator/go/files_generator.py +133 -0
  109. django_cfg/modules/django_client/core/generator/go/generator.py +203 -0
  110. django_cfg/modules/django_client/core/generator/go/models_generator.py +304 -0
  111. django_cfg/modules/django_client/core/generator/go/naming.py +193 -0
  112. django_cfg/modules/django_client/core/generator/go/operations_generator.py +134 -0
  113. django_cfg/modules/django_client/core/generator/go/templates/Makefile.j2 +38 -0
  114. django_cfg/modules/django_client/core/generator/go/templates/README.md.j2 +55 -0
  115. django_cfg/modules/django_client/core/generator/go/templates/client.go.j2 +122 -0
  116. django_cfg/modules/django_client/core/generator/go/templates/enums.go.j2 +49 -0
  117. django_cfg/modules/django_client/core/generator/go/templates/errors.go.j2 +182 -0
  118. django_cfg/modules/django_client/core/generator/go/templates/go.mod.j2 +6 -0
  119. django_cfg/modules/django_client/core/generator/go/templates/main_client.go.j2 +60 -0
  120. django_cfg/modules/django_client/core/generator/go/templates/middleware.go.j2 +388 -0
  121. django_cfg/modules/django_client/core/generator/go/templates/models.go.j2 +28 -0
  122. django_cfg/modules/django_client/core/generator/go/templates/operations_client.go.j2 +142 -0
  123. django_cfg/modules/django_client/core/generator/go/templates/validation.go.j2 +217 -0
  124. django_cfg/modules/django_client/core/generator/go/type_mapper.py +380 -0
  125. django_cfg/modules/django_client/management/commands/generate_client.py +53 -3
  126. django_cfg/modules/django_client/system/generate_mjs_clients.py +3 -1
  127. django_cfg/modules/django_client/system/schema_parser.py +5 -1
  128. django_cfg/modules/django_tailwind/templates/django_tailwind/base.html +1 -0
  129. django_cfg/modules/django_twilio/sendgrid_service.py +7 -4
  130. django_cfg/modules/django_unfold/dashboard.py +25 -19
  131. django_cfg/pyproject.toml +1 -1
  132. django_cfg/registry/core.py +2 -0
  133. django_cfg/registry/modules.py +2 -2
  134. django_cfg/static/js/api/centrifugo/client.mjs +164 -0
  135. django_cfg/static/js/api/centrifugo/index.mjs +13 -0
  136. django_cfg/static/js/api/index.mjs +5 -5
  137. django_cfg/static/js/api/types.mjs +89 -26
  138. {django_cfg-1.4.62.dist-info → django_cfg-1.4.64.dist-info}/METADATA +1 -1
  139. {django_cfg-1.4.62.dist-info → django_cfg-1.4.64.dist-info}/RECORD +142 -70
  140. django_cfg/apps/ipc/README.md +0 -346
  141. django_cfg/apps/ipc/RPC_LOGGING.md +0 -321
  142. django_cfg/apps/ipc/TESTING.md +0 -539
  143. django_cfg/apps/ipc/__init__.py +0 -60
  144. django_cfg/apps/ipc/admin.py +0 -232
  145. django_cfg/apps/ipc/apps.py +0 -98
  146. django_cfg/apps/ipc/migrations/0001_initial.py +0 -137
  147. django_cfg/apps/ipc/migrations/0002_rpclog_is_event.py +0 -23
  148. django_cfg/apps/ipc/migrations/__init__.py +0 -0
  149. django_cfg/apps/ipc/models.py +0 -229
  150. django_cfg/apps/ipc/serializers/__init__.py +0 -29
  151. django_cfg/apps/ipc/serializers/serializers.py +0 -343
  152. django_cfg/apps/ipc/services/__init__.py +0 -7
  153. django_cfg/apps/ipc/services/client/__init__.py +0 -23
  154. django_cfg/apps/ipc/services/client/client.py +0 -621
  155. django_cfg/apps/ipc/services/client/config.py +0 -214
  156. django_cfg/apps/ipc/services/client/exceptions.py +0 -201
  157. django_cfg/apps/ipc/services/logging.py +0 -239
  158. django_cfg/apps/ipc/services/monitor.py +0 -466
  159. django_cfg/apps/ipc/services/rpc_log_consumer.py +0 -330
  160. django_cfg/apps/ipc/static/django_cfg_ipc/js/dashboard/main.mjs +0 -269
  161. django_cfg/apps/ipc/static/django_cfg_ipc/js/dashboard/overview.mjs +0 -259
  162. django_cfg/apps/ipc/static/django_cfg_ipc/js/dashboard/testing.mjs +0 -375
  163. django_cfg/apps/ipc/static/django_cfg_ipc/js/dashboard.mjs.old +0 -441
  164. django_cfg/apps/ipc/templates/django_cfg_ipc/components/methods_content.html +0 -22
  165. django_cfg/apps/ipc/templates/django_cfg_ipc/components/notifications_content.html +0 -9
  166. django_cfg/apps/ipc/templates/django_cfg_ipc/components/overview_content.html +0 -9
  167. django_cfg/apps/ipc/templates/django_cfg_ipc/components/requests_content.html +0 -23
  168. django_cfg/apps/ipc/templates/django_cfg_ipc/components/system_status.html +0 -47
  169. django_cfg/apps/ipc/templates/django_cfg_ipc/components/testing_tools.html +0 -184
  170. django_cfg/apps/ipc/templates/django_cfg_ipc/layout/base.html +0 -71
  171. django_cfg/apps/ipc/templates/django_cfg_ipc/pages/dashboard.html +0 -56
  172. django_cfg/apps/ipc/urls.py +0 -23
  173. django_cfg/apps/ipc/views/__init__.py +0 -13
  174. django_cfg/apps/ipc/views/dashboard.py +0 -15
  175. django_cfg/apps/ipc/views/monitoring.py +0 -251
  176. django_cfg/apps/ipc/views/testing.py +0 -285
  177. django_cfg/static/js/api/ipc/client.mjs +0 -114
  178. django_cfg/static/js/api/ipc/index.mjs +0 -13
  179. {django_cfg-1.4.62.dist-info → django_cfg-1.4.64.dist-info}/WHEEL +0 -0
  180. {django_cfg-1.4.62.dist-info → django_cfg-1.4.64.dist-info}/entry_points.txt +0 -0
  181. {django_cfg-1.4.62.dist-info → django_cfg-1.4.64.dist-info}/licenses/LICENSE +0 -0
@@ -1,285 +0,0 @@
1
- """
2
- RPC Testing ViewSet.
3
-
4
- Provides REST API endpoints for testing RPC system with load testing capabilities.
5
- """
6
-
7
- import time
8
- import uuid
9
- from threading import Thread
10
-
11
- from django_cfg.modules.django_logging import get_logger
12
- from drf_spectacular.utils import extend_schema
13
- from rest_framework import status, viewsets
14
- from rest_framework.authentication import SessionAuthentication
15
- from rest_framework.decorators import action
16
- from rest_framework.permissions import IsAdminUser
17
- from rest_framework.response import Response
18
-
19
- from ..serializers import (
20
- LoadTestRequestSerializer,
21
- LoadTestResponseSerializer,
22
- LoadTestStatusSerializer,
23
- TestRPCRequestSerializer,
24
- TestRPCResponseSerializer,
25
- )
26
-
27
- logger = get_logger("ipc.testing")
28
-
29
- # Global load test state
30
- _load_test_state = {
31
- 'test_id': None,
32
- 'running': False,
33
- 'progress': 0,
34
- 'total': 0,
35
- 'success_count': 0,
36
- 'failed_count': 0,
37
- 'durations': [],
38
- 'start_time': None,
39
- }
40
-
41
-
42
- class RPCTestingViewSet(viewsets.ViewSet):
43
- """
44
- ViewSet for RPC testing tools.
45
-
46
- Provides endpoints for:
47
- - Sending test RPC requests
48
- - Running load tests with concurrent requests
49
- - Monitoring load test progress
50
- """
51
-
52
- authentication_classes = [SessionAuthentication]
53
- permission_classes = [IsAdminUser]
54
- serializer_class = TestRPCRequestSerializer # Default serializer for schema generation
55
-
56
- @extend_schema(
57
- tags=['IPC/RPC Testing'],
58
- summary="Send test RPC request",
59
- description="Send a single RPC request for testing purposes and measure response time.",
60
- request=TestRPCRequestSerializer,
61
- responses={
62
- 200: TestRPCResponseSerializer,
63
- 400: {"description": "Invalid parameters"},
64
- 500: {"description": "RPC call failed"},
65
- },
66
- )
67
- @action(detail=False, methods=['post'], url_path='send')
68
- def test_send(self, request):
69
- """Send a test RPC request and return response with timing."""
70
- serializer = TestRPCRequestSerializer(data=request.data)
71
-
72
- if not serializer.is_valid():
73
- return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
74
-
75
- method = serializer.validated_data['method']
76
- params = serializer.validated_data['params']
77
- timeout = serializer.validated_data.get('timeout', 10)
78
-
79
- correlation_id = str(uuid.uuid4())
80
- start_time = time.time()
81
-
82
- try:
83
- from django_cfg.apps.ipc import get_rpc_client
84
-
85
- rpc_client = get_rpc_client()
86
- result = rpc_client.call(
87
- method=method,
88
- params=params,
89
- timeout=timeout,
90
- user=request.user
91
- )
92
-
93
- duration_ms = (time.time() - start_time) * 1000
94
-
95
- response_data = {
96
- 'success': True,
97
- 'duration_ms': round(duration_ms, 2),
98
- 'response': result,
99
- 'error': None,
100
- 'correlation_id': correlation_id,
101
- }
102
-
103
- return Response(response_data)
104
-
105
- except Exception as e:
106
- duration_ms = (time.time() - start_time) * 1000
107
- logger.error(f"Test RPC call failed: {e}", exc_info=True)
108
-
109
- response_data = {
110
- 'success': False,
111
- 'duration_ms': round(duration_ms, 2),
112
- 'response': None,
113
- 'error': str(e),
114
- 'correlation_id': correlation_id,
115
- }
116
-
117
- return Response(response_data, status=status.HTTP_500_INTERNAL_SERVER_ERROR)
118
-
119
- @extend_schema(
120
- tags=['IPC/RPC Testing'],
121
- summary="Start load test",
122
- description="Start a load test by sending multiple concurrent RPC requests.",
123
- request=LoadTestRequestSerializer,
124
- responses={
125
- 200: LoadTestResponseSerializer,
126
- 400: {"description": "Invalid parameters"},
127
- 409: {"description": "Load test already running"},
128
- },
129
- )
130
- @action(detail=False, methods=['post'], url_path='load/start')
131
- def load_test_start(self, request):
132
- """Start a load test."""
133
- global _load_test_state
134
-
135
- if _load_test_state['running']:
136
- return Response(
137
- {'error': 'Load test already running'},
138
- status=status.HTTP_409_CONFLICT
139
- )
140
-
141
- serializer = LoadTestRequestSerializer(data=request.data)
142
- if not serializer.is_valid():
143
- return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
144
-
145
- test_id = str(uuid.uuid4())[:8]
146
- method = serializer.validated_data['method']
147
- total_requests = serializer.validated_data['total_requests']
148
- concurrency = serializer.validated_data['concurrency']
149
- params = serializer.validated_data.get('params', {})
150
-
151
- # Reset state
152
- _load_test_state.update({
153
- 'test_id': test_id,
154
- 'running': True,
155
- 'progress': 0,
156
- 'total': total_requests,
157
- 'success_count': 0,
158
- 'failed_count': 0,
159
- 'durations': [],
160
- 'start_time': time.time(),
161
- })
162
-
163
- # Start load test in background
164
- def run_load_test():
165
- from django_cfg.apps.ipc import get_rpc_client
166
-
167
- try:
168
- rpc_client = get_rpc_client()
169
-
170
- def send_request(index):
171
- try:
172
- start = time.time()
173
- rpc_client.call(
174
- method=method,
175
- params={**params, '_test_id': test_id, '_index': index},
176
- timeout=10,
177
- user=request.user
178
- )
179
- duration = (time.time() - start) * 1000
180
-
181
- _load_test_state['success_count'] += 1
182
- _load_test_state['durations'].append(duration)
183
- except Exception as e:
184
- logger.warning(f"Load test request {index} failed: {e}")
185
- _load_test_state['failed_count'] += 1
186
- finally:
187
- _load_test_state['progress'] += 1
188
-
189
- # Send requests in batches based on concurrency
190
- for i in range(0, total_requests, concurrency):
191
- if not _load_test_state['running']:
192
- break
193
-
194
- batch_size = min(concurrency, total_requests - i)
195
- threads = []
196
-
197
- for j in range(batch_size):
198
- thread = Thread(target=send_request, args=(i + j,))
199
- thread.start()
200
- threads.append(thread)
201
-
202
- for thread in threads:
203
- thread.join()
204
-
205
- except Exception as e:
206
- logger.error(f"Load test failed: {e}", exc_info=True)
207
- finally:
208
- _load_test_state['running'] = False
209
-
210
- thread = Thread(target=run_load_test)
211
- thread.daemon = True
212
- thread.start()
213
-
214
- return Response({
215
- 'test_id': test_id,
216
- 'started': True,
217
- 'message': f'Load test started with {total_requests} requests at {concurrency} concurrency'
218
- })
219
-
220
- @extend_schema(
221
- tags=['IPC/RPC Testing'],
222
- summary="Get load test status",
223
- description="Get current status of running or completed load test.",
224
- responses={
225
- 200: LoadTestStatusSerializer,
226
- },
227
- )
228
- @action(detail=False, methods=['get'], url_path='load/status')
229
- def load_test_status(self, request):
230
- """Get status of current load test."""
231
- global _load_test_state
232
-
233
- elapsed_time = 0
234
- if _load_test_state['start_time']:
235
- elapsed_time = time.time() - _load_test_state['start_time']
236
-
237
- avg_duration = 0
238
- if _load_test_state['durations']:
239
- avg_duration = sum(_load_test_state['durations']) / len(_load_test_state['durations'])
240
-
241
- rps = 0
242
- if elapsed_time > 0:
243
- rps = _load_test_state['progress'] / elapsed_time
244
-
245
- response_data = {
246
- 'test_id': _load_test_state['test_id'],
247
- 'running': _load_test_state['running'],
248
- 'progress': _load_test_state['progress'],
249
- 'total': _load_test_state['total'],
250
- 'success_count': _load_test_state['success_count'],
251
- 'failed_count': _load_test_state['failed_count'],
252
- 'avg_duration_ms': round(avg_duration, 2),
253
- 'elapsed_time': round(elapsed_time, 2),
254
- 'rps': round(rps, 2),
255
- }
256
-
257
- return Response(response_data)
258
-
259
- @extend_schema(
260
- tags=['IPC/RPC Testing'],
261
- summary="Stop load test",
262
- description="Stop currently running load test.",
263
- responses={
264
- 200: {"description": "Load test stopped"},
265
- 400: {"description": "No load test running"},
266
- },
267
- )
268
- @action(detail=False, methods=['post'], url_path='load/stop')
269
- def load_test_stop(self, request):
270
- """Stop current load test."""
271
- global _load_test_state
272
-
273
- if not _load_test_state['running']:
274
- return Response(
275
- {'message': 'No load test currently running'},
276
- status=status.HTTP_400_BAD_REQUEST
277
- )
278
-
279
- _load_test_state['running'] = False
280
-
281
- return Response({
282
- 'message': 'Load test stopped',
283
- 'progress': _load_test_state['progress'],
284
- 'total': _load_test_state['total']
285
- })
@@ -1,114 +0,0 @@
1
- import { BaseAPIClient } from '../base.mjs';
2
-
3
- /**
4
- * Ipc API Client
5
- * Auto-generated from OpenAPI schema
6
- * @module ipc
7
- * @extends BaseAPIClient
8
- */
9
- export class IpcAPI extends BaseAPIClient {
10
- /**
11
- * Initialize ipc API client
12
- * @param {string} [baseURL] - Optional base URL
13
- */
14
- constructor(baseURL) {
15
- super(baseURL);
16
- }
17
-
18
- /**
19
- * Get RPC health status * Returns the current health status of the RPC monitoring system. * @returns {Promise<HealthCheck>} Response data
20
- */
21
- async ipcAdminApiMonitorHealthRetrieve() {
22
- const path = `/cfg/ipc/admin/api/monitor/health/`; return this.get(path); }
23
- /**
24
- * Get method statistics * Returns statistics grouped by RPC method. * @returns {Promise<MethodStats>} Response data
25
- */
26
- async ipcAdminApiMonitorMethodsRetrieve() {
27
- const path = `/cfg/ipc/admin/api/monitor/methods/`; return this.get(path); }
28
- /**
29
- * Get notification statistics * Returns statistics about RPC notifications. * @returns {Promise<NotificationStats>} Response data
30
- */
31
- async ipcAdminApiMonitorNotificationsRetrieve() {
32
- const path = `/cfg/ipc/admin/api/monitor/notifications/`; return this.get(path); }
33
- /**
34
- * Get overview statistics * Returns overview statistics for RPC monitoring. * @returns {Promise<OverviewStats>} Response data
35
- */
36
- async ipcAdminApiMonitorOverviewRetrieve() {
37
- const path = `/cfg/ipc/admin/api/monitor/overview/`; return this.get(path); }
38
- /**
39
- * Get recent RPC requests * Returns a list of recent RPC requests with their details. * @param {Object} [params={}] - Query parameters * @param {number} [params.count] - Number of requests to return (default: 50, max: 200) * @returns {Promise<RecentRequests>} Response data
40
- */
41
- async ipcAdminApiMonitorRequestsRetrieve(params = {}) {
42
- const path = `/cfg/ipc/admin/api/monitor/requests/`; return this.get(path, params); }
43
- /**
44
- * Start load test * Start a load test by sending multiple concurrent RPC requests. * @param {LoadTestRequestRequest} data - Request body * @returns {Promise<LoadTestResponse>} Response data
45
- */
46
- async ipcAdminApiTestLoadStartCreate(data) {
47
- const path = `/cfg/ipc/admin/api/test/load/start/`; return this.post(path, data); }
48
- /**
49
- * Get load test status * Get current status of running or completed load test. * @returns {Promise<LoadTestStatus>} Response data
50
- */
51
- async ipcAdminApiTestLoadStatusRetrieve() {
52
- const path = `/cfg/ipc/admin/api/test/load/status/`; return this.get(path); }
53
- /**
54
- * Stop load test * Stop currently running load test. * @param {TestRPCRequestRequest} data - Request body * @returns {Promise<any>} Response data
55
- */
56
- async ipcAdminApiTestLoadStopCreate(data) {
57
- const path = `/cfg/ipc/admin/api/test/load/stop/`; return this.post(path, data); }
58
- /**
59
- * Send test RPC request * Send a single RPC request for testing purposes and measure response time. * @param {TestRPCRequestRequest} data - Request body * @returns {Promise<TestRPCResponse>} Response data
60
- */
61
- async ipcAdminApiTestSendCreate(data) {
62
- const path = `/cfg/ipc/admin/api/test/send/`; return this.post(path, data); }
63
- /**
64
- * Get RPC health status * Returns the current health status of the RPC monitoring system. * @returns {Promise<HealthCheck>} Response data
65
- */
66
- async ipcMonitorHealthRetrieve() {
67
- const path = `/cfg/ipc/monitor/health/`; return this.get(path); }
68
- /**
69
- * Get method statistics * Returns statistics grouped by RPC method. * @returns {Promise<MethodStats>} Response data
70
- */
71
- async ipcMonitorMethodsRetrieve() {
72
- const path = `/cfg/ipc/monitor/methods/`; return this.get(path); }
73
- /**
74
- * Get notification statistics * Returns statistics about RPC notifications. * @returns {Promise<NotificationStats>} Response data
75
- */
76
- async ipcMonitorNotificationsRetrieve() {
77
- const path = `/cfg/ipc/monitor/notifications/`; return this.get(path); }
78
- /**
79
- * Get overview statistics * Returns overview statistics for RPC monitoring. * @returns {Promise<OverviewStats>} Response data
80
- */
81
- async ipcMonitorOverviewRetrieve() {
82
- const path = `/cfg/ipc/monitor/overview/`; return this.get(path); }
83
- /**
84
- * Get recent RPC requests * Returns a list of recent RPC requests with their details. * @param {Object} [params={}] - Query parameters * @param {number} [params.count] - Number of requests to return (default: 50, max: 200) * @returns {Promise<RecentRequests>} Response data
85
- */
86
- async ipcMonitorRequestsRetrieve(params = {}) {
87
- const path = `/cfg/ipc/monitor/requests/`; return this.get(path, params); }
88
- /**
89
- * Start load test * Start a load test by sending multiple concurrent RPC requests. * @param {LoadTestRequestRequest} data - Request body * @returns {Promise<LoadTestResponse>} Response data
90
- */
91
- async ipcTestLoadStartCreate(data) {
92
- const path = `/cfg/ipc/test/load/start/`; return this.post(path, data); }
93
- /**
94
- * Get load test status * Get current status of running or completed load test. * @returns {Promise<LoadTestStatus>} Response data
95
- */
96
- async ipcTestLoadStatusRetrieve() {
97
- const path = `/cfg/ipc/test/load/status/`; return this.get(path); }
98
- /**
99
- * Stop load test * Stop currently running load test. * @param {TestRPCRequestRequest} data - Request body * @returns {Promise<any>} Response data
100
- */
101
- async ipcTestLoadStopCreate(data) {
102
- const path = `/cfg/ipc/test/load/stop/`; return this.post(path, data); }
103
- /**
104
- * Send test RPC request * Send a single RPC request for testing purposes and measure response time. * @param {TestRPCRequestRequest} data - Request body * @returns {Promise<TestRPCResponse>} Response data
105
- */
106
- async ipcTestSendCreate(data) {
107
- const path = `/cfg/ipc/test/send/`; return this.post(path, data); }
108
- }
109
-
110
- // Default instance for convenience
111
- export const ipcAPI = new IpcAPI();
112
-
113
- // Default export
114
- export default IpcAPI;
@@ -1,13 +0,0 @@
1
- /**
2
- * Ipc API Module
3
- * Re-exports the API client for convenient importing
4
- * @module ipc
5
- */
6
-
7
- import { IpcAPI, ipcAPI } from './client.mjs';
8
-
9
- // Re-export the class and instance
10
- export { IpcAPI, ipcAPI };
11
-
12
- // Default export is the instance for convenience
13
- export default ipcAPI;