asyncviz 0.1.0__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.
Files changed (927) hide show
  1. asyncviz/__init__.py +36 -0
  2. asyncviz/__main__.py +21 -0
  3. asyncviz/benchmarks/__init__.py +143 -0
  4. asyncviz/benchmarks/__main__.py +161 -0
  5. asyncviz/benchmarks/benchmark_baselines.py +82 -0
  6. asyncviz/benchmarks/benchmark_configuration.py +105 -0
  7. asyncviz/benchmarks/benchmark_diagnostics.py +44 -0
  8. asyncviz/benchmarks/benchmark_models.py +205 -0
  9. asyncviz/benchmarks/benchmark_observability.py +119 -0
  10. asyncviz/benchmarks/benchmark_registry.py +132 -0
  11. asyncviz/benchmarks/benchmark_runner.py +338 -0
  12. asyncviz/benchmarks/benchmark_statistics.py +149 -0
  13. asyncviz/benchmarks/benchmark_thresholds.py +72 -0
  14. asyncviz/benchmarks/benchmark_tracing.py +87 -0
  15. asyncviz/benchmarks/datasets/__init__.py +3 -0
  16. asyncviz/benchmarks/fixtures/__init__.py +7 -0
  17. asyncviz/benchmarks/instrumentation/__init__.py +13 -0
  18. asyncviz/benchmarks/instrumentation/bench_event_bus_publish.py +35 -0
  19. asyncviz/benchmarks/instrumentation/bench_event_serialization.py +24 -0
  20. asyncviz/benchmarks/memory/__init__.py +5 -0
  21. asyncviz/benchmarks/memory/bench_event_allocation.py +18 -0
  22. asyncviz/benchmarks/profiling/__init__.py +17 -0
  23. asyncviz/benchmarks/profiling/cpu_profile.py +69 -0
  24. asyncviz/benchmarks/profiling/tracemalloc_profile.py +64 -0
  25. asyncviz/benchmarks/rendering/__init__.py +3 -0
  26. asyncviz/benchmarks/replay/__init__.py +8 -0
  27. asyncviz/benchmarks/replay/bench_format_codec.py +33 -0
  28. asyncviz/benchmarks/replay/bench_loader_iteration.py +35 -0
  29. asyncviz/benchmarks/reporting/__init__.py +15 -0
  30. asyncviz/benchmarks/reporting/ci_summary.py +52 -0
  31. asyncviz/benchmarks/reporting/json_report.py +92 -0
  32. asyncviz/benchmarks/reporting/markdown_report.py +82 -0
  33. asyncviz/benchmarks/runtime/__init__.py +1 -0
  34. asyncviz/benchmarks/stress/__init__.py +6 -0
  35. asyncviz/benchmarks/stress/bench_event_storm.py +32 -0
  36. asyncviz/benchmarks/synthetic/__init__.py +10 -0
  37. asyncviz/benchmarks/synthetic/event_workload.py +28 -0
  38. asyncviz/benchmarks/synthetic/recording_workload.py +121 -0
  39. asyncviz/benchmarks/utilities/__init__.py +23 -0
  40. asyncviz/benchmarks/utilities/gc_control.py +45 -0
  41. asyncviz/benchmarks/utilities/memory.py +58 -0
  42. asyncviz/benchmarks/utilities/timing.py +71 -0
  43. asyncviz/benchmarks/websocket/__init__.py +5 -0
  44. asyncviz/benchmarks/websocket/bench_event_serialization.py +25 -0
  45. asyncviz/bootstrap/__init__.py +24 -0
  46. asyncviz/bootstrap/bootstrap.py +165 -0
  47. asyncviz/bootstrap/browser.py +36 -0
  48. asyncviz/bootstrap/config.py +54 -0
  49. asyncviz/bootstrap/runtime.py +60 -0
  50. asyncviz/bootstrap/services.py +103 -0
  51. asyncviz/bootstrap/validation.py +68 -0
  52. asyncviz/cli/__init__.py +12 -0
  53. asyncviz/cli/browser/__init__.py +156 -0
  54. asyncviz/cli/browser/browser_availability.py +50 -0
  55. asyncviz/cli/browser/browser_backpressure.py +78 -0
  56. asyncviz/cli/browser/browser_configuration.py +61 -0
  57. asyncviz/cli/browser/browser_detection.py +131 -0
  58. asyncviz/cli/browser/browser_diagnostics.py +88 -0
  59. asyncviz/cli/browser/browser_launcher.py +417 -0
  60. asyncviz/cli/browser/browser_metrics.py +100 -0
  61. asyncviz/cli/browser/browser_policy.py +108 -0
  62. asyncviz/cli/browser/browser_preferences.py +69 -0
  63. asyncviz/cli/browser/browser_process.py +90 -0
  64. asyncviz/cli/browser/browser_readiness.py +111 -0
  65. asyncviz/cli/browser/browser_sessions.py +63 -0
  66. asyncviz/cli/browser/browser_statistics.py +58 -0
  67. asyncviz/cli/browser/browser_tracing.py +64 -0
  68. asyncviz/cli/browser/browser_urls.py +38 -0
  69. asyncviz/cli/commands/__init__.py +20 -0
  70. asyncviz/cli/commands/doctor.py +149 -0
  71. asyncviz/cli/commands/record.py +51 -0
  72. asyncviz/cli/commands/replay.py +34 -0
  73. asyncviz/cli/commands/run.py +23 -0
  74. asyncviz/cli/commands/version.py +38 -0
  75. asyncviz/cli/configuration/__init__.py +40 -0
  76. asyncviz/cli/configuration/cli_configuration.py +155 -0
  77. asyncviz/cli/configuration/defaults.py +32 -0
  78. asyncviz/cli/configuration/validation.py +104 -0
  79. asyncviz/cli/entrypoint.py +74 -0
  80. asyncviz/cli/exit_codes.py +68 -0
  81. asyncviz/cli/main.py +21 -0
  82. asyncviz/cli/output.py +99 -0
  83. asyncviz/cli/parser.py +661 -0
  84. asyncviz/cli/runtime/__init__.py +68 -0
  85. asyncviz/cli/runtime/bootstrap_entry.py +401 -0
  86. asyncviz/cli/runtime/diagnostics.py +55 -0
  87. asyncviz/cli/runtime/instrumentation_injection.py +39 -0
  88. asyncviz/cli/runtime/launcher.py +159 -0
  89. asyncviz/cli/runtime/lifecycle.py +84 -0
  90. asyncviz/cli/runtime/loop_discovery.py +153 -0
  91. asyncviz/cli/runtime/observability.py +108 -0
  92. asyncviz/cli/runtime/process_environment.py +40 -0
  93. asyncviz/cli/runtime/replay_bundle_adapter.py +243 -0
  94. asyncviz/cli/runtime/replay_launcher.py +453 -0
  95. asyncviz/cli/runtime/subprocess_runner.py +121 -0
  96. asyncviz/collector/__init__.py +0 -0
  97. asyncviz/config.py +134 -0
  98. asyncviz/configuration/__init__.py +137 -0
  99. asyncviz/configuration/environment/__init__.py +172 -0
  100. asyncviz/configuration/environment/environment_defaults.py +28 -0
  101. asyncviz/configuration/environment/environment_diagnostics.py +63 -0
  102. asyncviz/configuration/environment/environment_loader.py +149 -0
  103. asyncviz/configuration/environment/environment_mapping.py +255 -0
  104. asyncviz/configuration/environment/environment_namespaces.py +74 -0
  105. asyncviz/configuration/environment/environment_normalization.py +35 -0
  106. asyncviz/configuration/environment/environment_observability.py +72 -0
  107. asyncviz/configuration/environment/environment_overrides.py +54 -0
  108. asyncviz/configuration/environment/environment_parser.py +176 -0
  109. asyncviz/configuration/environment/environment_provenance.py +57 -0
  110. asyncviz/configuration/environment/environment_resolution.py +188 -0
  111. asyncviz/configuration/environment/environment_security.py +35 -0
  112. asyncviz/configuration/environment/environment_serialization.py +119 -0
  113. asyncviz/configuration/environment/environment_tracing.py +62 -0
  114. asyncviz/configuration/environment/environment_types.py +75 -0
  115. asyncviz/configuration/environment/environment_validation.py +69 -0
  116. asyncviz/configuration/runtime_browser.py +36 -0
  117. asyncviz/configuration/runtime_cli_mapping.py +53 -0
  118. asyncviz/configuration/runtime_configuration.py +55 -0
  119. asyncviz/configuration/runtime_dashboard.py +40 -0
  120. asyncviz/configuration/runtime_defaults.py +61 -0
  121. asyncviz/configuration/runtime_diagnostics.py +94 -0
  122. asyncviz/configuration/runtime_environment.py +211 -0
  123. asyncviz/configuration/runtime_metadata.py +71 -0
  124. asyncviz/configuration/runtime_monitoring.py +33 -0
  125. asyncviz/configuration/runtime_network.py +31 -0
  126. asyncviz/configuration/runtime_observability.py +68 -0
  127. asyncviz/configuration/runtime_options.py +92 -0
  128. asyncviz/configuration/runtime_overrides.py +175 -0
  129. asyncviz/configuration/runtime_profiles.py +80 -0
  130. asyncviz/configuration/runtime_recording.py +50 -0
  131. asyncviz/configuration/runtime_replay.py +25 -0
  132. asyncviz/configuration/runtime_resolution.py +160 -0
  133. asyncviz/configuration/runtime_security.py +28 -0
  134. asyncviz/configuration/runtime_serialization.py +76 -0
  135. asyncviz/configuration/runtime_sources.py +46 -0
  136. asyncviz/configuration/runtime_tracing.py +64 -0
  137. asyncviz/configuration/runtime_validation.py +155 -0
  138. asyncviz/configuration/runtime_warning.py +25 -0
  139. asyncviz/dashboard/__init__.py +3 -0
  140. asyncviz/dashboard/app.py +448 -0
  141. asyncviz/dashboard/asgi.py +19 -0
  142. asyncviz/dashboard/assets/__init__.py +167 -0
  143. asyncviz/dashboard/assets/asset_build.py +85 -0
  144. asyncviz/dashboard/assets/asset_cache.py +90 -0
  145. asyncviz/dashboard/assets/asset_diagnostics.py +87 -0
  146. asyncviz/dashboard/assets/asset_export.py +42 -0
  147. asyncviz/dashboard/assets/asset_integrity.py +41 -0
  148. asyncviz/dashboard/assets/asset_layout.py +55 -0
  149. asyncviz/dashboard/assets/asset_manifest.py +118 -0
  150. asyncviz/dashboard/assets/asset_metadata.py +54 -0
  151. asyncviz/dashboard/assets/asset_observability.py +78 -0
  152. asyncviz/dashboard/assets/asset_packaging.py +58 -0
  153. asyncviz/dashboard/assets/asset_packaging_inspect.py +108 -0
  154. asyncviz/dashboard/assets/asset_publisher.py +188 -0
  155. asyncviz/dashboard/assets/asset_registry.py +70 -0
  156. asyncviz/dashboard/assets/asset_resolution.py +83 -0
  157. asyncviz/dashboard/assets/asset_tracing.py +61 -0
  158. asyncviz/dashboard/assets/asset_validation.py +153 -0
  159. asyncviz/dashboard/assets/asset_versioning.py +57 -0
  160. asyncviz/dashboard/dependencies.py +151 -0
  161. asyncviz/dashboard/exceptions.py +121 -0
  162. asyncviz/dashboard/frontend_serving/__init__.py +96 -0
  163. asyncviz/dashboard/frontend_serving/assets.py +148 -0
  164. asyncviz/dashboard/frontend_serving/cache.py +46 -0
  165. asyncviz/dashboard/frontend_serving/configuration.py +56 -0
  166. asyncviz/dashboard/frontend_serving/exceptions.py +35 -0
  167. asyncviz/dashboard/frontend_serving/manifest.py +142 -0
  168. asyncviz/dashboard/frontend_serving/metrics.py +137 -0
  169. asyncviz/dashboard/frontend_serving/models.py +72 -0
  170. asyncviz/dashboard/frontend_serving/packaging.py +30 -0
  171. asyncviz/dashboard/frontend_serving/service.py +294 -0
  172. asyncviz/dashboard/frontend_serving/spa.py +77 -0
  173. asyncviz/dashboard/health/__init__.py +92 -0
  174. asyncviz/dashboard/health/checks.py +155 -0
  175. asyncviz/dashboard/health/exceptions.py +19 -0
  176. asyncviz/dashboard/health/metrics.py +134 -0
  177. asyncviz/dashboard/health/models.py +182 -0
  178. asyncviz/dashboard/health/probes.py +365 -0
  179. asyncviz/dashboard/health/registry.py +130 -0
  180. asyncviz/dashboard/health/service.py +240 -0
  181. asyncviz/dashboard/health/status.py +81 -0
  182. asyncviz/dashboard/lifespan.py +244 -0
  183. asyncviz/dashboard/middleware/__init__.py +43 -0
  184. asyncviz/dashboard/middleware/correlation.py +49 -0
  185. asyncviz/dashboard/middleware/errors.py +60 -0
  186. asyncviz/dashboard/middleware/logging.py +55 -0
  187. asyncviz/dashboard/middleware/timing.py +78 -0
  188. asyncviz/dashboard/replay/__init__.py +11 -0
  189. asyncviz/dashboard/replay/dashboard_sink.py +211 -0
  190. asyncviz/dashboard/replay/replay_marker_derivation.py +383 -0
  191. asyncviz/dashboard/replay/replay_status_broadcaster.py +288 -0
  192. asyncviz/dashboard/routes/__init__.py +29 -0
  193. asyncviz/dashboard/routes/assets.py +44 -0
  194. asyncviz/dashboard/routes/configuration.py +57 -0
  195. asyncviz/dashboard/routes/executor.py +48 -0
  196. asyncviz/dashboard/routes/executor_metrics.py +55 -0
  197. asyncviz/dashboard/routes/gather.py +41 -0
  198. asyncviz/dashboard/routes/health.py +111 -0
  199. asyncviz/dashboard/routes/packaging.py +78 -0
  200. asyncviz/dashboard/routes/queue_metrics.py +59 -0
  201. asyncviz/dashboard/routes/queues.py +41 -0
  202. asyncviz/dashboard/routes/runtime.py +1124 -0
  203. asyncviz/dashboard/routes/semaphores.py +41 -0
  204. asyncviz/dashboard/routes/websocket.py +63 -0
  205. asyncviz/dashboard/runner.py +31 -0
  206. asyncviz/dashboard/snapshots/__init__.py +57 -0
  207. asyncviz/dashboard/snapshots/exceptions.py +18 -0
  208. asyncviz/dashboard/snapshots/hydration.py +268 -0
  209. asyncviz/dashboard/snapshots/metrics.py +121 -0
  210. asyncviz/dashboard/snapshots/models.py +185 -0
  211. asyncviz/dashboard/state/__init__.py +0 -0
  212. asyncviz/dashboard/state/backend.py +90 -0
  213. asyncviz/dashboard/state/backend_metrics.py +136 -0
  214. asyncviz/dashboard/state/metrics_state.py +37 -0
  215. asyncviz/dashboard/state/runtime_state.py +66 -0
  216. asyncviz/dashboard/static/.gitkeep +0 -0
  217. asyncviz/dashboard/static/assets/index-BoCBbGHF.js +68 -0
  218. asyncviz/dashboard/static/assets/index-DMU-teJh.css +1 -0
  219. asyncviz/dashboard/static/index.html +13 -0
  220. asyncviz/dashboard/websocket/__init__.py +0 -0
  221. asyncviz/dashboard/websocket/backpressure.py +30 -0
  222. asyncviz/dashboard/websocket/bridge.py +278 -0
  223. asyncviz/dashboard/websocket/client.py +50 -0
  224. asyncviz/dashboard/websocket/exceptions.py +29 -0
  225. asyncviz/dashboard/websocket/gateway.py +337 -0
  226. asyncviz/dashboard/websocket/handshake.py +99 -0
  227. asyncviz/dashboard/websocket/heartbeat.py +34 -0
  228. asyncviz/dashboard/websocket/manager.py +121 -0
  229. asyncviz/dashboard/websocket/metrics.py +116 -0
  230. asyncviz/dashboard/websocket/protocol.py +204 -0
  231. asyncviz/dashboard/websocket/session_manager.py +125 -0
  232. asyncviz/dashboard/websocket/sessions.py +129 -0
  233. asyncviz/dashboard/websocket/shutdown_filter.py +239 -0
  234. asyncviz/dashboard/websocket/streaming/__init__.py +49 -0
  235. asyncviz/dashboard/websocket/streaming/batching.py +30 -0
  236. asyncviz/dashboard/websocket/streaming/engine.py +244 -0
  237. asyncviz/dashboard/websocket/streaming/envelopes.py +64 -0
  238. asyncviz/dashboard/websocket/streaming/exceptions.py +13 -0
  239. asyncviz/dashboard/websocket/streaming/metrics.py +106 -0
  240. asyncviz/instrumentation/__init__.py +3 -0
  241. asyncviz/instrumentation/asyncio/__init__.py +13 -0
  242. asyncviz/instrumentation/asyncio/context.py +101 -0
  243. asyncviz/instrumentation/asyncio/create_task.py +89 -0
  244. asyncviz/instrumentation/asyncio/exceptions.py +13 -0
  245. asyncviz/instrumentation/asyncio/ids.py +13 -0
  246. asyncviz/instrumentation/asyncio/lifecycle.py +124 -0
  247. asyncviz/instrumentation/asyncio/metadata.py +36 -0
  248. asyncviz/instrumentation/asyncio/patcher.py +97 -0
  249. asyncviz/instrumentation/asyncio/wrappers.py +82 -0
  250. asyncviz/instrumentation/executor/__init__.py +85 -0
  251. asyncviz/instrumentation/executor/executor_configuration.py +27 -0
  252. asyncviz/instrumentation/executor/executor_diagnostics.py +97 -0
  253. asyncviz/instrumentation/executor/executor_internal.py +38 -0
  254. asyncviz/instrumentation/executor/executor_metadata.py +64 -0
  255. asyncviz/instrumentation/executor/executor_observability.py +137 -0
  256. asyncviz/instrumentation/executor/executor_patch.py +614 -0
  257. asyncviz/instrumentation/executor/executor_registry.py +292 -0
  258. asyncviz/instrumentation/executor/executor_state.py +53 -0
  259. asyncviz/instrumentation/executor/executor_tracing.py +61 -0
  260. asyncviz/instrumentation/executor/metrics/__init__.py +69 -0
  261. asyncviz/instrumentation/executor/metrics/executor_metrics_configuration.py +85 -0
  262. asyncviz/instrumentation/executor/metrics/executor_metrics_diagnostics.py +48 -0
  263. asyncviz/instrumentation/executor/metrics/executor_metrics_engine.py +438 -0
  264. asyncviz/instrumentation/executor/metrics/executor_metrics_models.py +160 -0
  265. asyncviz/instrumentation/executor/metrics/executor_metrics_observability.py +117 -0
  266. asyncviz/instrumentation/executor/metrics/executor_metrics_replay.py +30 -0
  267. asyncviz/instrumentation/executor/metrics/executor_metrics_saturation.py +123 -0
  268. asyncviz/instrumentation/executor/metrics/executor_metrics_state.py +229 -0
  269. asyncviz/instrumentation/executor/metrics/executor_metrics_statistics.py +83 -0
  270. asyncviz/instrumentation/executor/metrics/executor_metrics_throughput.py +67 -0
  271. asyncviz/instrumentation/executor/metrics/executor_metrics_tracing.py +59 -0
  272. asyncviz/instrumentation/executor/metrics/executor_metrics_utilization.py +58 -0
  273. asyncviz/instrumentation/executor/metrics/executor_metrics_windows.py +37 -0
  274. asyncviz/instrumentation/gather/__init__.py +72 -0
  275. asyncviz/instrumentation/gather/gather_configuration.py +33 -0
  276. asyncviz/instrumentation/gather/gather_diagnostics.py +70 -0
  277. asyncviz/instrumentation/gather/gather_internal.py +49 -0
  278. asyncviz/instrumentation/gather/gather_metadata.py +50 -0
  279. asyncviz/instrumentation/gather/gather_observability.py +137 -0
  280. asyncviz/instrumentation/gather/gather_patch.py +650 -0
  281. asyncviz/instrumentation/gather/gather_registry.py +175 -0
  282. asyncviz/instrumentation/gather/gather_tracing.py +67 -0
  283. asyncviz/instrumentation/queue/__init__.py +80 -0
  284. asyncviz/instrumentation/queue/metrics/__init__.py +86 -0
  285. asyncviz/instrumentation/queue/metrics/queue_metrics_backpressure.py +17 -0
  286. asyncviz/instrumentation/queue/metrics/queue_metrics_configuration.py +91 -0
  287. asyncviz/instrumentation/queue/metrics/queue_metrics_contention.py +82 -0
  288. asyncviz/instrumentation/queue/metrics/queue_metrics_diagnostics.py +53 -0
  289. asyncviz/instrumentation/queue/metrics/queue_metrics_engine.py +486 -0
  290. asyncviz/instrumentation/queue/metrics/queue_metrics_models.py +174 -0
  291. asyncviz/instrumentation/queue/metrics/queue_metrics_observability.py +129 -0
  292. asyncviz/instrumentation/queue/metrics/queue_metrics_pressure.py +133 -0
  293. asyncviz/instrumentation/queue/metrics/queue_metrics_replay.py +34 -0
  294. asyncviz/instrumentation/queue/metrics/queue_metrics_serialization.py +41 -0
  295. asyncviz/instrumentation/queue/metrics/queue_metrics_state.py +282 -0
  296. asyncviz/instrumentation/queue/metrics/queue_metrics_statistics.py +94 -0
  297. asyncviz/instrumentation/queue/metrics/queue_metrics_throughput.py +78 -0
  298. asyncviz/instrumentation/queue/metrics/queue_metrics_tracing.py +65 -0
  299. asyncviz/instrumentation/queue/metrics/queue_metrics_windows.py +42 -0
  300. asyncviz/instrumentation/queue/queue_configuration.py +48 -0
  301. asyncviz/instrumentation/queue/queue_diagnostics.py +70 -0
  302. asyncviz/instrumentation/queue/queue_internal.py +47 -0
  303. asyncviz/instrumentation/queue/queue_metadata.py +50 -0
  304. asyncviz/instrumentation/queue/queue_observability.py +107 -0
  305. asyncviz/instrumentation/queue/queue_patch.py +533 -0
  306. asyncviz/instrumentation/queue/queue_registry.py +133 -0
  307. asyncviz/instrumentation/queue/queue_state.py +59 -0
  308. asyncviz/instrumentation/queue/queue_tracing.py +59 -0
  309. asyncviz/instrumentation/semaphore/__init__.py +84 -0
  310. asyncviz/instrumentation/semaphore/semaphore_configuration.py +48 -0
  311. asyncviz/instrumentation/semaphore/semaphore_diagnostics.py +71 -0
  312. asyncviz/instrumentation/semaphore/semaphore_internal.py +34 -0
  313. asyncviz/instrumentation/semaphore/semaphore_metadata.py +64 -0
  314. asyncviz/instrumentation/semaphore/semaphore_observability.py +130 -0
  315. asyncviz/instrumentation/semaphore/semaphore_patch.py +565 -0
  316. asyncviz/instrumentation/semaphore/semaphore_registry.py +134 -0
  317. asyncviz/instrumentation/semaphore/semaphore_state.py +88 -0
  318. asyncviz/instrumentation/semaphore/semaphore_tracing.py +67 -0
  319. asyncviz/models/__init__.py +0 -0
  320. asyncviz/packaging/__init__.py +82 -0
  321. asyncviz/packaging/assets.py +195 -0
  322. asyncviz/packaging/build_metadata.py +215 -0
  323. asyncviz/packaging/diagnostics.py +116 -0
  324. asyncviz/packaging/utils/__init__.py +8 -0
  325. asyncviz/packaging/versioning.py +221 -0
  326. asyncviz/packaging/wheel_validation.py +236 -0
  327. asyncviz/py.typed +0 -0
  328. asyncviz/replay/__init__.py +14 -0
  329. asyncviz/replay/format/__init__.py +185 -0
  330. asyncviz/replay/format/models/__init__.py +31 -0
  331. asyncviz/replay/format/models/payloads.py +246 -0
  332. asyncviz/replay/format/ndjson_backpressure.py +94 -0
  333. asyncviz/replay/format/ndjson_deserialization.py +175 -0
  334. asyncviz/replay/format/ndjson_diagnostics.py +67 -0
  335. asyncviz/replay/format/ndjson_format.py +140 -0
  336. asyncviz/replay/format/ndjson_frame.py +236 -0
  337. asyncviz/replay/format/ndjson_integrity.py +101 -0
  338. asyncviz/replay/format/ndjson_observability.py +163 -0
  339. asyncviz/replay/format/ndjson_reader.py +103 -0
  340. asyncviz/replay/format/ndjson_recovery.py +113 -0
  341. asyncviz/replay/format/ndjson_registry.py +158 -0
  342. asyncviz/replay/format/ndjson_schema.py +90 -0
  343. asyncviz/replay/format/ndjson_serialization.py +101 -0
  344. asyncviz/replay/format/ndjson_streaming.py +122 -0
  345. asyncviz/replay/format/ndjson_tracing.py +95 -0
  346. asyncviz/replay/format/ndjson_validation.py +159 -0
  347. asyncviz/replay/format/ndjson_versioning.py +179 -0
  348. asyncviz/replay/format/ndjson_writer.py +98 -0
  349. asyncviz/replay/format/utils/__init__.py +9 -0
  350. asyncviz/replay/format/utils/canonical_json.py +82 -0
  351. asyncviz/replay/loading/__init__.py +202 -0
  352. asyncviz/replay/loading/models/__init__.py +23 -0
  353. asyncviz/replay/loading/models/frame_adapter.py +143 -0
  354. asyncviz/replay/loading/models/replay_session.py +77 -0
  355. asyncviz/replay/loading/replay_backpressure.py +59 -0
  356. asyncviz/replay/loading/replay_chunk_loader.py +118 -0
  357. asyncviz/replay/loading/replay_configuration.py +76 -0
  358. asyncviz/replay/loading/replay_cursor.py +76 -0
  359. asyncviz/replay/loading/replay_diagnostics.py +35 -0
  360. asyncviz/replay/loading/replay_filtering.py +147 -0
  361. asyncviz/replay/loading/replay_index.py +99 -0
  362. asyncviz/replay/loading/replay_integrity_loader.py +104 -0
  363. asyncviz/replay/loading/replay_iterator.py +52 -0
  364. asyncviz/replay/loading/replay_loader.py +369 -0
  365. asyncviz/replay/loading/replay_manifest_loader.py +135 -0
  366. asyncviz/replay/loading/replay_observability.py +173 -0
  367. asyncviz/replay/loading/replay_recovery_loader.py +129 -0
  368. asyncviz/replay/loading/replay_seek.py +226 -0
  369. asyncviz/replay/loading/replay_snapshot_index.py +104 -0
  370. asyncviz/replay/loading/replay_state_loader.py +155 -0
  371. asyncviz/replay/loading/replay_stream.py +92 -0
  372. asyncviz/replay/loading/replay_tracing.py +85 -0
  373. asyncviz/replay/loading/replay_validation_loader.py +77 -0
  374. asyncviz/replay/loading/replay_windowing.py +68 -0
  375. asyncviz/replay/loading/utils/__init__.py +8 -0
  376. asyncviz/replay/loading/utils/frame_navigation.py +47 -0
  377. asyncviz/replay/recording/__init__.py +159 -0
  378. asyncviz/replay/recording/recording_backpressure.py +105 -0
  379. asyncviz/replay/recording/recording_configuration.py +74 -0
  380. asyncviz/replay/recording/recording_diagnostics.py +83 -0
  381. asyncviz/replay/recording/recording_export.py +53 -0
  382. asyncviz/replay/recording/recording_index.py +112 -0
  383. asyncviz/replay/recording/recording_integrity.py +110 -0
  384. asyncviz/replay/recording/recording_layout.py +77 -0
  385. asyncviz/replay/recording/recording_manifest.py +65 -0
  386. asyncviz/replay/recording/recording_metadata.py +115 -0
  387. asyncviz/replay/recording/recording_observability.py +152 -0
  388. asyncviz/replay/recording/recording_paths.py +51 -0
  389. asyncviz/replay/recording/recording_recovery.py +166 -0
  390. asyncviz/replay/recording/recording_session.py +96 -0
  391. asyncviz/replay/recording/recording_stream.py +95 -0
  392. asyncviz/replay/recording/recording_tracing.py +68 -0
  393. asyncviz/replay/recording/recording_writer.py +399 -0
  394. asyncviz/replay/recording/runtime_recorder.py +322 -0
  395. asyncviz/replay/runtime/__init__.py +187 -0
  396. asyncviz/replay/runtime/control/__init__.py +137 -0
  397. asyncviz/replay/runtime/control/models/__init__.py +19 -0
  398. asyncviz/replay/runtime/control/models/pause_request.py +64 -0
  399. asyncviz/replay/runtime/control/models/playback_phase.py +87 -0
  400. asyncviz/replay/runtime/control/replay_clock_coordination.py +93 -0
  401. asyncviz/replay/runtime/control/replay_control_dispatch.py +152 -0
  402. asyncviz/replay/runtime/control/replay_pause_barrier.py +94 -0
  403. asyncviz/replay/runtime/control/replay_pause_controller.py +211 -0
  404. asyncviz/replay/runtime/control/replay_playback_backpressure.py +86 -0
  405. asyncviz/replay/runtime/control/replay_playback_configuration.py +80 -0
  406. asyncviz/replay/runtime/control/replay_playback_coordinator.py +365 -0
  407. asyncviz/replay/runtime/control/replay_playback_diagnostics.py +53 -0
  408. asyncviz/replay/runtime/control/replay_playback_gate.py +51 -0
  409. asyncviz/replay/runtime/control/replay_playback_observability.py +181 -0
  410. asyncviz/replay/runtime/control/replay_playback_state.py +122 -0
  411. asyncviz/replay/runtime/control/replay_playback_tracing.py +94 -0
  412. asyncviz/replay/runtime/control/replay_resume_barrier.py +84 -0
  413. asyncviz/replay/runtime/control/replay_resume_controller.py +136 -0
  414. asyncviz/replay/runtime/control/replay_scheduler_coordination.py +52 -0
  415. asyncviz/replay/runtime/control/replay_transition_guard.py +121 -0
  416. asyncviz/replay/runtime/control/utils/__init__.py +1 -0
  417. asyncviz/replay/runtime/models/__init__.py +15 -0
  418. asyncviz/replay/runtime/models/engine_cursor.py +72 -0
  419. asyncviz/replay/runtime/models/playback_state.py +47 -0
  420. asyncviz/replay/runtime/models/runtime_state.py +92 -0
  421. asyncviz/replay/runtime/replay_backpressure.py +87 -0
  422. asyncviz/replay/runtime/replay_checkpoint_runtime.py +83 -0
  423. asyncviz/replay/runtime/replay_clock.py +153 -0
  424. asyncviz/replay/runtime/replay_configuration.py +73 -0
  425. asyncviz/replay/runtime/replay_cursor_runtime.py +35 -0
  426. asyncviz/replay/runtime/replay_diagnostics.py +42 -0
  427. asyncviz/replay/runtime/replay_dispatch.py +111 -0
  428. asyncviz/replay/runtime/replay_event_router.py +83 -0
  429. asyncviz/replay/runtime/replay_integrity_runtime.py +83 -0
  430. asyncviz/replay/runtime/replay_observability.py +189 -0
  431. asyncviz/replay/runtime/replay_pause.py +95 -0
  432. asyncviz/replay/runtime/replay_playback.py +240 -0
  433. asyncviz/replay/runtime/replay_projection.py +104 -0
  434. asyncviz/replay/runtime/replay_reducers.py +122 -0
  435. asyncviz/replay/runtime/replay_runtime_engine.py +280 -0
  436. asyncviz/replay/runtime/replay_scheduler.py +101 -0
  437. asyncviz/replay/runtime/replay_seek_runtime.py +172 -0
  438. asyncviz/replay/runtime/replay_snapshot_runtime.py +80 -0
  439. asyncviz/replay/runtime/replay_speed.py +89 -0
  440. asyncviz/replay/runtime/replay_state_store.py +87 -0
  441. asyncviz/replay/runtime/replay_tracing.py +87 -0
  442. asyncviz/replay/runtime/replay_websocket_bridge.py +115 -0
  443. asyncviz/replay/runtime/seek/__init__.py +149 -0
  444. asyncviz/replay/runtime/seek/models/__init__.py +21 -0
  445. asyncviz/replay/runtime/seek/models/seek_cursor.py +40 -0
  446. asyncviz/replay/runtime/seek/models/seek_request.py +98 -0
  447. asyncviz/replay/runtime/seek/models/seek_state.py +71 -0
  448. asyncviz/replay/runtime/seek/replay_seek_backpressure.py +78 -0
  449. asyncviz/replay/runtime/seek/replay_seek_cache.py +112 -0
  450. asyncviz/replay/runtime/seek/replay_seek_checkpoint.py +50 -0
  451. asyncviz/replay/runtime/seek/replay_seek_clock.py +70 -0
  452. asyncviz/replay/runtime/seek/replay_seek_configuration.py +86 -0
  453. asyncviz/replay/runtime/seek/replay_seek_coordinator.py +318 -0
  454. asyncviz/replay/runtime/seek/replay_seek_cursor.py +30 -0
  455. asyncviz/replay/runtime/seek/replay_seek_diagnostics.py +48 -0
  456. asyncviz/replay/runtime/seek/replay_seek_dispatch.py +175 -0
  457. asyncviz/replay/runtime/seek/replay_seek_engine.py +166 -0
  458. asyncviz/replay/runtime/seek/replay_seek_integrity.py +74 -0
  459. asyncviz/replay/runtime/seek/replay_seek_observability.py +170 -0
  460. asyncviz/replay/runtime/seek/replay_seek_projection.py +50 -0
  461. asyncviz/replay/runtime/seek/replay_seek_reconstruction.py +160 -0
  462. asyncviz/replay/runtime/seek/replay_seek_scheduler.py +37 -0
  463. asyncviz/replay/runtime/seek/replay_seek_state.py +63 -0
  464. asyncviz/replay/runtime/seek/replay_seek_tracing.py +85 -0
  465. asyncviz/replay/runtime/seek/utils/__init__.py +5 -0
  466. asyncviz/replay/runtime/seek/utils/targets.py +55 -0
  467. asyncviz/replay/runtime/speed/__init__.py +143 -0
  468. asyncviz/replay/runtime/speed/models/__init__.py +23 -0
  469. asyncviz/replay/runtime/speed/models/speed_phase.py +61 -0
  470. asyncviz/replay/runtime/speed/models/speed_profile.py +73 -0
  471. asyncviz/replay/runtime/speed/models/speed_request.py +50 -0
  472. asyncviz/replay/runtime/speed/replay_speed_backpressure.py +80 -0
  473. asyncviz/replay/runtime/speed/replay_speed_clock.py +125 -0
  474. asyncviz/replay/runtime/speed/replay_speed_configuration.py +100 -0
  475. asyncviz/replay/runtime/speed/replay_speed_controller.py +221 -0
  476. asyncviz/replay/runtime/speed/replay_speed_coordination.py +86 -0
  477. asyncviz/replay/runtime/speed/replay_speed_diagnostics.py +59 -0
  478. asyncviz/replay/runtime/speed/replay_speed_dispatch.py +284 -0
  479. asyncviz/replay/runtime/speed/replay_speed_integrity.py +58 -0
  480. asyncviz/replay/runtime/speed/replay_speed_limits.py +84 -0
  481. asyncviz/replay/runtime/speed/replay_speed_observability.py +156 -0
  482. asyncviz/replay/runtime/speed/replay_speed_presets.py +34 -0
  483. asyncviz/replay/runtime/speed/replay_speed_profile.py +20 -0
  484. asyncviz/replay/runtime/speed/replay_speed_scheduler.py +33 -0
  485. asyncviz/replay/runtime/speed/replay_speed_state.py +80 -0
  486. asyncviz/replay/runtime/speed/replay_speed_tracing.py +83 -0
  487. asyncviz/replay/runtime/speed/replay_speed_transition.py +61 -0
  488. asyncviz/replay/runtime/speed/utils/__init__.py +1 -0
  489. asyncviz/replay/runtime/utils/__init__.py +5 -0
  490. asyncviz/replay/runtime/utils/timing.py +13 -0
  491. asyncviz/runtime/__init__.py +29 -0
  492. asyncviz/runtime/backpressure/__init__.py +177 -0
  493. asyncviz/runtime/backpressure/adaptive_backpressure.py +188 -0
  494. asyncviz/runtime/backpressure/backpressure_budget.py +90 -0
  495. asyncviz/runtime/backpressure/backpressure_configuration.py +149 -0
  496. asyncviz/runtime/backpressure/backpressure_diagnostics.py +49 -0
  497. asyncviz/runtime/backpressure/backpressure_integrity.py +74 -0
  498. asyncviz/runtime/backpressure/backpressure_observability.py +139 -0
  499. asyncviz/runtime/backpressure/backpressure_policy.py +143 -0
  500. asyncviz/runtime/backpressure/backpressure_queue.py +216 -0
  501. asyncviz/runtime/backpressure/backpressure_thresholds.py +49 -0
  502. asyncviz/runtime/backpressure/backpressure_tracing.py +92 -0
  503. asyncviz/runtime/backpressure/bounded_event_channel.py +96 -0
  504. asyncviz/runtime/backpressure/event_backpressure_controller.py +345 -0
  505. asyncviz/runtime/backpressure/models/__init__.py +27 -0
  506. asyncviz/runtime/backpressure/models/degradation_action.py +32 -0
  507. asyncviz/runtime/backpressure/models/overflow_marker.py +48 -0
  508. asyncviz/runtime/backpressure/models/overload_state.py +68 -0
  509. asyncviz/runtime/backpressure/models/pressure_signal.py +39 -0
  510. asyncviz/runtime/backpressure/overload_detector.py +205 -0
  511. asyncviz/runtime/backpressure/reducer_backpressure.py +102 -0
  512. asyncviz/runtime/backpressure/replay_backpressure.py +172 -0
  513. asyncviz/runtime/backpressure/topology_backpressure.py +87 -0
  514. asyncviz/runtime/backpressure/utils/__init__.py +9 -0
  515. asyncviz/runtime/backpressure/utils/hysteresis.py +27 -0
  516. asyncviz/runtime/backpressure/websocket_backpressure.py +195 -0
  517. asyncviz/runtime/clock/__init__.py +64 -0
  518. asyncviz/runtime/clock/clock.py +225 -0
  519. asyncviz/runtime/clock/conversions.py +40 -0
  520. asyncviz/runtime/clock/exceptions.py +22 -0
  521. asyncviz/runtime/clock/models.py +43 -0
  522. asyncviz/runtime/clock/sequence.py +49 -0
  523. asyncviz/runtime/clock/synchronization.py +53 -0
  524. asyncviz/runtime/clock/timestamps.py +120 -0
  525. asyncviz/runtime/compat/__init__.py +154 -0
  526. asyncviz/runtime/compat/loop_adapter.py +144 -0
  527. asyncviz/runtime/compat/loop_clock_bridge.py +138 -0
  528. asyncviz/runtime/compat/loop_configuration.py +95 -0
  529. asyncviz/runtime/compat/loop_diagnostics.py +70 -0
  530. asyncviz/runtime/compat/loop_feature_detection.py +146 -0
  531. asyncviz/runtime/compat/loop_integrity.py +107 -0
  532. asyncviz/runtime/compat/loop_observability.py +151 -0
  533. asyncviz/runtime/compat/loop_policy_bridge.py +125 -0
  534. asyncviz/runtime/compat/loop_queue_bridge.py +120 -0
  535. asyncviz/runtime/compat/loop_scheduler_bridge.py +133 -0
  536. asyncviz/runtime/compat/loop_task_bridge.py +162 -0
  537. asyncviz/runtime/compat/loop_tracing.py +75 -0
  538. asyncviz/runtime/compat/models/__init__.py +21 -0
  539. asyncviz/runtime/compat/models/loop_capabilities.py +85 -0
  540. asyncviz/runtime/compat/models/loop_kind.py +28 -0
  541. asyncviz/runtime/compat/models/loop_state.py +37 -0
  542. asyncviz/runtime/compat/replay_loop_bridge.py +136 -0
  543. asyncviz/runtime/compat/uvloop_compat.py +333 -0
  544. asyncviz/runtime/compat/websocket_loop_bridge.py +111 -0
  545. asyncviz/runtime/events/__init__.py +90 -0
  546. asyncviz/runtime/events/bus.py +231 -0
  547. asyncviz/runtime/events/dispatcher.py +64 -0
  548. asyncviz/runtime/events/event.py +10 -0
  549. asyncviz/runtime/events/exceptions.py +13 -0
  550. asyncviz/runtime/events/metrics.py +38 -0
  551. asyncviz/runtime/events/models/__init__.py +175 -0
  552. asyncviz/runtime/events/models/base.py +98 -0
  553. asyncviz/runtime/events/models/enums.py +121 -0
  554. asyncviz/runtime/events/models/executor.py +94 -0
  555. asyncviz/runtime/events/models/executor_metrics.py +112 -0
  556. asyncviz/runtime/events/models/factory.py +160 -0
  557. asyncviz/runtime/events/models/gather.py +121 -0
  558. asyncviz/runtime/events/models/metrics.py +15 -0
  559. asyncviz/runtime/events/models/queue.py +106 -0
  560. asyncviz/runtime/events/models/queue_metrics.py +140 -0
  561. asyncviz/runtime/events/models/runtime.py +23 -0
  562. asyncviz/runtime/events/models/semaphore.py +111 -0
  563. asyncviz/runtime/events/models/serialization.py +152 -0
  564. asyncviz/runtime/events/models/task.py +74 -0
  565. asyncviz/runtime/events/models/warnings.py +16 -0
  566. asyncviz/runtime/events/queue.py +49 -0
  567. asyncviz/runtime/events/subscriber.py +106 -0
  568. asyncviz/runtime/lineage/__init__.py +99 -0
  569. asyncviz/runtime/lineage/ancestry.py +147 -0
  570. asyncviz/runtime/lineage/context.py +71 -0
  571. asyncviz/runtime/lineage/exceptions.py +31 -0
  572. asyncviz/runtime/lineage/graph.py +85 -0
  573. asyncviz/runtime/lineage/models.py +53 -0
  574. asyncviz/runtime/lineage/propagation.py +60 -0
  575. asyncviz/runtime/lineage/snapshots.py +24 -0
  576. asyncviz/runtime/lineage/tracker.py +223 -0
  577. asyncviz/runtime/memory/__init__.py +165 -0
  578. asyncviz/runtime/memory/compact_event_models.py +11 -0
  579. asyncviz/runtime/memory/event_compaction.py +54 -0
  580. asyncviz/runtime/memory/event_deduplication.py +81 -0
  581. asyncviz/runtime/memory/event_interning.py +122 -0
  582. asyncviz/runtime/memory/event_memory_layout.py +125 -0
  583. asyncviz/runtime/memory/event_pooling.py +168 -0
  584. asyncviz/runtime/memory/memory_backpressure.py +44 -0
  585. asyncviz/runtime/memory/memory_configuration.py +112 -0
  586. asyncviz/runtime/memory/memory_diagnostics.py +52 -0
  587. asyncviz/runtime/memory/memory_observability.py +216 -0
  588. asyncviz/runtime/memory/memory_optimizer.py +248 -0
  589. asyncviz/runtime/memory/memory_thresholds.py +91 -0
  590. asyncviz/runtime/memory/memory_tracing.py +89 -0
  591. asyncviz/runtime/memory/models/__init__.py +15 -0
  592. asyncviz/runtime/memory/models/compact_event.py +80 -0
  593. asyncviz/runtime/memory/models/compact_frame.py +55 -0
  594. asyncviz/runtime/memory/models/pool_token.py +25 -0
  595. asyncviz/runtime/memory/reducer_memory.py +135 -0
  596. asyncviz/runtime/memory/replay_compaction.py +88 -0
  597. asyncviz/runtime/memory/replay_memory_layout.py +63 -0
  598. asyncviz/runtime/memory/topology_memory.py +123 -0
  599. asyncviz/runtime/memory/utils/__init__.py +1 -0
  600. asyncviz/runtime/memory/websocket_memory.py +112 -0
  601. asyncviz/runtime/metrics/__init__.py +126 -0
  602. asyncviz/runtime/metrics/aggregator.py +385 -0
  603. asyncviz/runtime/metrics/counters.py +56 -0
  604. asyncviz/runtime/metrics/durations.py +86 -0
  605. asyncviz/runtime/metrics/exceptions.py +13 -0
  606. asyncviz/runtime/metrics/histograms.py +142 -0
  607. asyncviz/runtime/metrics/lineage.py +69 -0
  608. asyncviz/runtime/metrics/models.py +169 -0
  609. asyncviz/runtime/metrics/normalization.py +77 -0
  610. asyncviz/runtime/metrics/projections.py +89 -0
  611. asyncviz/runtime/metrics/queries.py +49 -0
  612. asyncviz/runtime/metrics/rates.py +90 -0
  613. asyncviz/runtime/metrics/reducers.py +94 -0
  614. asyncviz/runtime/metrics/snapshots.py +197 -0
  615. asyncviz/runtime/metrics/streaming.py +90 -0
  616. asyncviz/runtime/monitoring/__init__.py +94 -0
  617. asyncviz/runtime/monitoring/blocking/__init__.py +157 -0
  618. asyncviz/runtime/monitoring/blocking/blocking_backpressure.py +82 -0
  619. asyncviz/runtime/monitoring/blocking/blocking_classifier.py +121 -0
  620. asyncviz/runtime/monitoring/blocking/blocking_configuration.py +81 -0
  621. asyncviz/runtime/monitoring/blocking/blocking_cooldown.py +149 -0
  622. asyncviz/runtime/monitoring/blocking/blocking_detector.py +655 -0
  623. asyncviz/runtime/monitoring/blocking/blocking_diagnostics.py +131 -0
  624. asyncviz/runtime/monitoring/blocking/blocking_escalation.py +152 -0
  625. asyncviz/runtime/monitoring/blocking/blocking_events.py +136 -0
  626. asyncviz/runtime/monitoring/blocking/blocking_metrics.py +208 -0
  627. asyncviz/runtime/monitoring/blocking/blocking_observability.py +45 -0
  628. asyncviz/runtime/monitoring/blocking/blocking_replay.py +39 -0
  629. asyncviz/runtime/monitoring/blocking/blocking_state.py +56 -0
  630. asyncviz/runtime/monitoring/blocking/blocking_statistics.py +193 -0
  631. asyncviz/runtime/monitoring/blocking/blocking_thresholds.py +79 -0
  632. asyncviz/runtime/monitoring/blocking/blocking_tracing.py +78 -0
  633. asyncviz/runtime/monitoring/blocking/blocking_windows.py +322 -0
  634. asyncviz/runtime/monitoring/blocking/models/__init__.py +35 -0
  635. asyncviz/runtime/monitoring/blocking/stack_capture/__init__.py +154 -0
  636. asyncviz/runtime/monitoring/blocking/stack_capture/models/__init__.py +39 -0
  637. asyncviz/runtime/monitoring/blocking/stack_capture/stack_capture_backpressure.py +81 -0
  638. asyncviz/runtime/monitoring/blocking/stack_capture/stack_capture_configuration.py +80 -0
  639. asyncviz/runtime/monitoring/blocking/stack_capture/stack_capture_context.py +135 -0
  640. asyncviz/runtime/monitoring/blocking/stack_capture/stack_capture_diagnostics.py +115 -0
  641. asyncviz/runtime/monitoring/blocking/stack_capture/stack_capture_engine.py +605 -0
  642. asyncviz/runtime/monitoring/blocking/stack_capture/stack_capture_events.py +46 -0
  643. asyncviz/runtime/monitoring/blocking/stack_capture/stack_capture_filters.py +96 -0
  644. asyncviz/runtime/monitoring/blocking/stack_capture/stack_capture_frames.py +163 -0
  645. asyncviz/runtime/monitoring/blocking/stack_capture/stack_capture_limits.py +54 -0
  646. asyncviz/runtime/monitoring/blocking/stack_capture/stack_capture_metrics.py +176 -0
  647. asyncviz/runtime/monitoring/blocking/stack_capture/stack_capture_observability.py +38 -0
  648. asyncviz/runtime/monitoring/blocking/stack_capture/stack_capture_policy.py +181 -0
  649. asyncviz/runtime/monitoring/blocking/stack_capture/stack_capture_replay.py +111 -0
  650. asyncviz/runtime/monitoring/blocking/stack_capture/stack_capture_sampler.py +234 -0
  651. asyncviz/runtime/monitoring/blocking/stack_capture/stack_capture_serializer.py +104 -0
  652. asyncviz/runtime/monitoring/blocking/stack_capture/stack_capture_statistics.py +153 -0
  653. asyncviz/runtime/monitoring/blocking/stack_capture/stack_capture_tracing.py +69 -0
  654. asyncviz/runtime/monitoring/blocking/stack_capture/tests/__init__.py +1 -0
  655. asyncviz/runtime/monitoring/blocking/stack_capture/utils/__init__.py +8 -0
  656. asyncviz/runtime/monitoring/blocking/stack_capture/utils/synthetic_frames.py +38 -0
  657. asyncviz/runtime/monitoring/blocking/tests/__init__.py +1 -0
  658. asyncviz/runtime/monitoring/blocking/utils/__init__.py +10 -0
  659. asyncviz/runtime/monitoring/event_loop/__init__.py +100 -0
  660. asyncviz/runtime/monitoring/event_loop/lag_backpressure.py +108 -0
  661. asyncviz/runtime/monitoring/event_loop/lag_clock.py +117 -0
  662. asyncviz/runtime/monitoring/event_loop/lag_configuration.py +133 -0
  663. asyncviz/runtime/monitoring/event_loop/lag_diagnostics.py +114 -0
  664. asyncviz/runtime/monitoring/event_loop/lag_events.py +104 -0
  665. asyncviz/runtime/monitoring/event_loop/lag_measurement.py +112 -0
  666. asyncviz/runtime/monitoring/event_loop/lag_metrics.py +184 -0
  667. asyncviz/runtime/monitoring/event_loop/lag_monitor.py +498 -0
  668. asyncviz/runtime/monitoring/event_loop/lag_observability.py +47 -0
  669. asyncviz/runtime/monitoring/event_loop/lag_sampler.py +69 -0
  670. asyncviz/runtime/monitoring/event_loop/lag_scheduler.py +285 -0
  671. asyncviz/runtime/monitoring/event_loop/lag_state.py +67 -0
  672. asyncviz/runtime/monitoring/event_loop/lag_statistics.py +261 -0
  673. asyncviz/runtime/monitoring/event_loop/lag_thresholds.py +166 -0
  674. asyncviz/runtime/monitoring/event_loop/lag_tracing.py +86 -0
  675. asyncviz/runtime/monitoring/event_loop/models/__init__.py +30 -0
  676. asyncviz/runtime/monitoring/event_loop/tests/__init__.py +6 -0
  677. asyncviz/runtime/monitoring/event_loop/utils/__init__.py +9 -0
  678. asyncviz/runtime/monitoring/event_loop/utils/fake_clock.py +54 -0
  679. asyncviz/runtime/queue/__init__.py +64 -0
  680. asyncviz/runtime/queue/backpressure.py +29 -0
  681. asyncviz/runtime/queue/buffering.py +23 -0
  682. asyncviz/runtime/queue/channels.py +65 -0
  683. asyncviz/runtime/queue/dispatcher.py +109 -0
  684. asyncviz/runtime/queue/event_queue.py +348 -0
  685. asyncviz/runtime/queue/exceptions.py +26 -0
  686. asyncviz/runtime/queue/metrics.py +140 -0
  687. asyncviz/runtime/queue/retention.py +110 -0
  688. asyncviz/runtime/queue/snapshots.py +42 -0
  689. asyncviz/runtime/replay/__init__.py +86 -0
  690. asyncviz/runtime/replay/artifacts/__init__.py +53 -0
  691. asyncviz/runtime/replay/artifacts/replay_bundle.py +81 -0
  692. asyncviz/runtime/replay/artifacts/replay_index.py +54 -0
  693. asyncviz/runtime/replay/artifacts/replay_layout.py +72 -0
  694. asyncviz/runtime/replay/artifacts/replay_validation.py +173 -0
  695. asyncviz/runtime/replay/buffer.py +426 -0
  696. asyncviz/runtime/replay/checkpoints.py +108 -0
  697. asyncviz/runtime/replay/exceptions.py +22 -0
  698. asyncviz/runtime/replay/frames.py +68 -0
  699. asyncviz/runtime/replay/indexing.py +75 -0
  700. asyncviz/runtime/replay/models.py +103 -0
  701. asyncviz/runtime/replay/reconstruction.py +53 -0
  702. asyncviz/runtime/replay/recorder/__init__.py +129 -0
  703. asyncviz/runtime/replay/recorder/replay_backpressure.py +112 -0
  704. asyncviz/runtime/replay/recorder/replay_chunking.py +41 -0
  705. asyncviz/runtime/replay/recorder/replay_compression.py +44 -0
  706. asyncviz/runtime/replay/recorder/replay_configuration.py +85 -0
  707. asyncviz/runtime/replay/recorder/replay_diagnostics.py +42 -0
  708. asyncviz/runtime/replay/recorder/replay_export.py +177 -0
  709. asyncviz/runtime/replay/recorder/replay_integrity.py +55 -0
  710. asyncviz/runtime/replay/recorder/replay_manifest.py +144 -0
  711. asyncviz/runtime/replay/recorder/replay_metadata.py +82 -0
  712. asyncviz/runtime/replay/recorder/replay_metrics.py +96 -0
  713. asyncviz/runtime/replay/recorder/replay_recorder.py +415 -0
  714. asyncviz/runtime/replay/recorder/replay_serializer.py +34 -0
  715. asyncviz/runtime/replay/recorder/replay_statistics.py +86 -0
  716. asyncviz/runtime/replay/recorder/replay_tracing.py +65 -0
  717. asyncviz/runtime/replay/recorder/replay_writer.py +169 -0
  718. asyncviz/runtime/replay/retention.py +117 -0
  719. asyncviz/runtime/replay/streaming.py +67 -0
  720. asyncviz/runtime/resilience/__init__.py +183 -0
  721. asyncviz/runtime/resilience/circuit_breaker.py +195 -0
  722. asyncviz/runtime/resilience/degradation_policy.py +45 -0
  723. asyncviz/runtime/resilience/failure_classifier.py +94 -0
  724. asyncviz/runtime/resilience/failure_domain.py +176 -0
  725. asyncviz/runtime/resilience/isolation_backpressure.py +119 -0
  726. asyncviz/runtime/resilience/isolation_configuration.py +239 -0
  727. asyncviz/runtime/resilience/isolation_diagnostics.py +61 -0
  728. asyncviz/runtime/resilience/isolation_integrity.py +88 -0
  729. asyncviz/runtime/resilience/isolation_observability.py +171 -0
  730. asyncviz/runtime/resilience/isolation_tracing.py +77 -0
  731. asyncviz/runtime/resilience/models/__init__.py +35 -0
  732. asyncviz/runtime/resilience/models/breaker_state.py +25 -0
  733. asyncviz/runtime/resilience/models/failure_event.py +27 -0
  734. asyncviz/runtime/resilience/models/failure_kind.py +42 -0
  735. asyncviz/runtime/resilience/models/recovery_outcome.py +23 -0
  736. asyncviz/runtime/resilience/models/subsystem_id.py +32 -0
  737. asyncviz/runtime/resilience/recorder_failure_isolation.py +66 -0
  738. asyncviz/runtime/resilience/recovery_supervisor.py +215 -0
  739. asyncviz/runtime/resilience/reducer_failure_isolation.py +60 -0
  740. asyncviz/runtime/resilience/render_failure_isolation.py +67 -0
  741. asyncviz/runtime/resilience/replay_failure_isolation.py +82 -0
  742. asyncviz/runtime/resilience/runtime_failure_manager.py +472 -0
  743. asyncviz/runtime/resilience/subsystem_boundary.py +195 -0
  744. asyncviz/runtime/resilience/websocket_failure_isolation.py +89 -0
  745. asyncviz/runtime/sampling/__init__.py +153 -0
  746. asyncviz/runtime/sampling/adaptive_sampling.py +126 -0
  747. asyncviz/runtime/sampling/event_sampler.py +164 -0
  748. asyncviz/runtime/sampling/models/__init__.py +23 -0
  749. asyncviz/runtime/sampling/models/sampling_decision.py +41 -0
  750. asyncviz/runtime/sampling/models/sampling_marker.py +54 -0
  751. asyncviz/runtime/sampling/models/sampling_priority.py +92 -0
  752. asyncviz/runtime/sampling/replay_sampling.py +131 -0
  753. asyncviz/runtime/sampling/sampling_backpressure.py +95 -0
  754. asyncviz/runtime/sampling/sampling_budget.py +88 -0
  755. asyncviz/runtime/sampling/sampling_configuration.py +137 -0
  756. asyncviz/runtime/sampling/sampling_diagnostics.py +52 -0
  757. asyncviz/runtime/sampling/sampling_integrity.py +73 -0
  758. asyncviz/runtime/sampling/sampling_observability.py +184 -0
  759. asyncviz/runtime/sampling/sampling_policy.py +184 -0
  760. asyncviz/runtime/sampling/sampling_priority.py +14 -0
  761. asyncviz/runtime/sampling/sampling_statistics.py +87 -0
  762. asyncviz/runtime/sampling/sampling_thresholds.py +109 -0
  763. asyncviz/runtime/sampling/sampling_tracing.py +87 -0
  764. asyncviz/runtime/sampling/topology_sampling.py +60 -0
  765. asyncviz/runtime/sampling/utils/__init__.py +8 -0
  766. asyncviz/runtime/sampling/utils/hashing.py +41 -0
  767. asyncviz/runtime/sampling/websocket_sampling.py +116 -0
  768. asyncviz/runtime/shutdown/__init__.py +73 -0
  769. asyncviz/runtime/shutdown/coordinator.py +603 -0
  770. asyncviz/runtime/shutdown/exceptions.py +32 -0
  771. asyncviz/runtime/shutdown/metrics.py +154 -0
  772. asyncviz/runtime/shutdown/models.py +85 -0
  773. asyncviz/runtime/shutdown/status.py +65 -0
  774. asyncviz/runtime/shutdown/timeouts.py +50 -0
  775. asyncviz/runtime/state/__init__.py +128 -0
  776. asyncviz/runtime/state/exceptions.py +22 -0
  777. asyncviz/runtime/state/indexes.py +92 -0
  778. asyncviz/runtime/state/lifecycle.py +30 -0
  779. asyncviz/runtime/state/metrics.py +156 -0
  780. asyncviz/runtime/state/models.py +102 -0
  781. asyncviz/runtime/state/normalization.py +66 -0
  782. asyncviz/runtime/state/projections.py +168 -0
  783. asyncviz/runtime/state/queries.py +55 -0
  784. asyncviz/runtime/state/reconciliation.py +90 -0
  785. asyncviz/runtime/state/reducers/__init__.py +218 -0
  786. asyncviz/runtime/state/reducers/base.py +90 -0
  787. asyncviz/runtime/state/reducers/exceptions.py +32 -0
  788. asyncviz/runtime/state/reducers/lifecycle.py +148 -0
  789. asyncviz/runtime/state/reducers/metrics.py +106 -0
  790. asyncviz/runtime/state/reducers/projections.py +69 -0
  791. asyncviz/runtime/state/reducers/reconciliation.py +46 -0
  792. asyncviz/runtime/state/reducers/registry.py +110 -0
  793. asyncviz/runtime/state/reducers/task_cancelled.py +30 -0
  794. asyncviz/runtime/state/reducers/task_completed.py +30 -0
  795. asyncviz/runtime/state/reducers/task_created.py +60 -0
  796. asyncviz/runtime/state/reducers/task_failed.py +28 -0
  797. asyncviz/runtime/state/reducers/task_resumed.py +22 -0
  798. asyncviz/runtime/state/reducers/task_started.py +22 -0
  799. asyncviz/runtime/state/reducers/task_waiting.py +22 -0
  800. asyncviz/runtime/state/reducers/transitions.py +140 -0
  801. asyncviz/runtime/state/reducers/validation.py +109 -0
  802. asyncviz/runtime/state/snapshots.py +94 -0
  803. asyncviz/runtime/state/store.py +317 -0
  804. asyncviz/runtime/state/subscriptions.py +90 -0
  805. asyncviz/runtime/tasks/__init__.py +38 -0
  806. asyncviz/runtime/tasks/exceptions.py +35 -0
  807. asyncviz/runtime/tasks/indexing.py +79 -0
  808. asyncviz/runtime/tasks/metrics.py +147 -0
  809. asyncviz/runtime/tasks/models.py +149 -0
  810. asyncviz/runtime/tasks/registry.py +386 -0
  811. asyncviz/runtime/tasks/snapshots.py +17 -0
  812. asyncviz/runtime/tasks/state.py +53 -0
  813. asyncviz/runtime/timeline/__init__.py +142 -0
  814. asyncviz/runtime/timeline/buffering.py +88 -0
  815. asyncviz/runtime/timeline/engine.py +400 -0
  816. asyncviz/runtime/timeline/exceptions.py +22 -0
  817. asyncviz/runtime/timeline/lifecycle.py +87 -0
  818. asyncviz/runtime/timeline/metrics.py +109 -0
  819. asyncviz/runtime/timeline/models.py +127 -0
  820. asyncviz/runtime/timeline/normalization.py +62 -0
  821. asyncviz/runtime/timeline/projections.py +97 -0
  822. asyncviz/runtime/timeline/queries.py +76 -0
  823. asyncviz/runtime/timeline/reconstruction.py +96 -0
  824. asyncviz/runtime/timeline/reducers.py +215 -0
  825. asyncviz/runtime/timeline/segments.py +58 -0
  826. asyncviz/runtime/timeline/snapshots.py +93 -0
  827. asyncviz/runtime/timeline/spans.py +67 -0
  828. asyncviz/runtime/timeline/streaming.py +103 -0
  829. asyncviz/runtime/warnings/__init__.py +131 -0
  830. asyncviz/runtime/warnings/blocking/__init__.py +167 -0
  831. asyncviz/runtime/warnings/blocking/blocking_warning_backpressure.py +81 -0
  832. asyncviz/runtime/warnings/blocking/blocking_warning_configuration.py +82 -0
  833. asyncviz/runtime/warnings/blocking/blocking_warning_correlation.py +74 -0
  834. asyncviz/runtime/warnings/blocking/blocking_warning_deduplication.py +119 -0
  835. asyncviz/runtime/warnings/blocking/blocking_warning_diagnostics.py +122 -0
  836. asyncviz/runtime/warnings/blocking/blocking_warning_emitter.py +759 -0
  837. asyncviz/runtime/warnings/blocking/blocking_warning_events.py +89 -0
  838. asyncviz/runtime/warnings/blocking/blocking_warning_grouping.py +323 -0
  839. asyncviz/runtime/warnings/blocking/blocking_warning_metrics.py +214 -0
  840. asyncviz/runtime/warnings/blocking/blocking_warning_observability.py +40 -0
  841. asyncviz/runtime/warnings/blocking/blocking_warning_payloads.py +126 -0
  842. asyncviz/runtime/warnings/blocking/blocking_warning_policy.py +91 -0
  843. asyncviz/runtime/warnings/blocking/blocking_warning_replay.py +99 -0
  844. asyncviz/runtime/warnings/blocking/blocking_warning_router.py +107 -0
  845. asyncviz/runtime/warnings/blocking/blocking_warning_state.py +96 -0
  846. asyncviz/runtime/warnings/blocking/blocking_warning_statistics.py +183 -0
  847. asyncviz/runtime/warnings/blocking/blocking_warning_tracing.py +74 -0
  848. asyncviz/runtime/warnings/blocking/models/__init__.py +43 -0
  849. asyncviz/runtime/warnings/blocking/tests/__init__.py +1 -0
  850. asyncviz/runtime/warnings/blocking/utils/__init__.py +13 -0
  851. asyncviz/runtime/warnings/blocking/utils/synthetic_outcomes.py +156 -0
  852. asyncviz/runtime/warnings/deduplication.py +68 -0
  853. asyncviz/runtime/warnings/detectors.py +785 -0
  854. asyncviz/runtime/warnings/exceptions.py +17 -0
  855. asyncviz/runtime/warnings/expiration.py +35 -0
  856. asyncviz/runtime/warnings/lifecycle.py +98 -0
  857. asyncviz/runtime/warnings/manager.py +450 -0
  858. asyncviz/runtime/warnings/models.py +106 -0
  859. asyncviz/runtime/warnings/normalization.py +40 -0
  860. asyncviz/runtime/warnings/projections.py +58 -0
  861. asyncviz/runtime/warnings/queries.py +48 -0
  862. asyncviz/runtime/warnings/severity.py +42 -0
  863. asyncviz/runtime/warnings/snapshots.py +85 -0
  864. asyncviz/runtime/warnings/streaming.py +84 -0
  865. asyncviz/start.py +9 -0
  866. asyncviz/stress/__init__.py +238 -0
  867. asyncviz/stress/_builtin_scenarios.py +239 -0
  868. asyncviz/stress/diagnostics/__init__.py +15 -0
  869. asyncviz/stress/executor_storms/__init__.py +7 -0
  870. asyncviz/stress/executor_storms/executor_fanout_storm.py +31 -0
  871. asyncviz/stress/failure_injection/__init__.py +13 -0
  872. asyncviz/stress/failure_injection/failure_registry.py +119 -0
  873. asyncviz/stress/fixtures/__init__.py +46 -0
  874. asyncviz/stress/harness/__init__.py +8 -0
  875. asyncviz/stress/harness/scenario_context.py +97 -0
  876. asyncviz/stress/models/__init__.py +27 -0
  877. asyncviz/stress/models/stress_outcome.py +51 -0
  878. asyncviz/stress/models/stress_scenario.py +45 -0
  879. asyncviz/stress/models/stress_signal.py +35 -0
  880. asyncviz/stress/observability/__init__.py +17 -0
  881. asyncviz/stress/queue_storms/__init__.py +7 -0
  882. asyncviz/stress/queue_storms/queue_saturation_storm.py +53 -0
  883. asyncviz/stress/rendering_storms/__init__.py +13 -0
  884. asyncviz/stress/rendering_storms/overlay_explosion_storm.py +32 -0
  885. asyncviz/stress/rendering_storms/render_flood_storm.py +57 -0
  886. asyncviz/stress/replay_storms/__init__.py +5 -0
  887. asyncviz/stress/replay_storms/replay_scrub_storm.py +31 -0
  888. asyncviz/stress/scalability_reports/__init__.py +15 -0
  889. asyncviz/stress/scalability_reports/scalability_report.py +260 -0
  890. asyncviz/stress/semaphore_storms/__init__.py +7 -0
  891. asyncviz/stress/semaphore_storms/semaphore_contention_storm.py +31 -0
  892. asyncviz/stress/stress_configuration.py +181 -0
  893. asyncviz/stress/stress_diagnostics.py +42 -0
  894. asyncviz/stress/stress_integrity.py +94 -0
  895. asyncviz/stress/stress_observability.py +219 -0
  896. asyncviz/stress/stress_registry.py +145 -0
  897. asyncviz/stress/stress_runner.py +302 -0
  898. asyncviz/stress/stress_thresholds.py +161 -0
  899. asyncviz/stress/stress_tracing.py +78 -0
  900. asyncviz/stress/synthetic/__init__.py +5 -0
  901. asyncviz/stress/synthetic/synthetic_loop_storm.py +22 -0
  902. asyncviz/stress/task_storms/__init__.py +13 -0
  903. asyncviz/stress/task_storms/cancellation_storm.py +43 -0
  904. asyncviz/stress/task_storms/gather_storm.py +32 -0
  905. asyncviz/stress/task_storms/task_creation_storm.py +41 -0
  906. asyncviz/stress/task_storms/task_lifecycle_storm.py +55 -0
  907. asyncviz/stress/topology_storms/__init__.py +7 -0
  908. asyncviz/stress/topology_storms/topology_explosion_storm.py +41 -0
  909. asyncviz/stress/utils/__init__.py +5 -0
  910. asyncviz/stress/utils/deterministic_rng.py +61 -0
  911. asyncviz/stress/websocket_floods/__init__.py +11 -0
  912. asyncviz/stress/websocket_floods/replay_stream_flood.py +38 -0
  913. asyncviz/stress/websocket_floods/websocket_flood.py +82 -0
  914. asyncviz/stress/workload_generators/__init__.py +31 -0
  915. asyncviz/stress/workload_generators/event_workload.py +77 -0
  916. asyncviz/stress/workload_generators/payload_workload.py +54 -0
  917. asyncviz/stress/workload_generators/task_workload.py +69 -0
  918. asyncviz/stress/workload_generators/topology_workload.py +53 -0
  919. asyncviz/utils/__init__.py +0 -0
  920. asyncviz/utils/env.py +62 -0
  921. asyncviz/utils/logging.py +26 -0
  922. asyncviz/websocket/__init__.py +0 -0
  923. asyncviz-0.1.0.dist-info/METADATA +369 -0
  924. asyncviz-0.1.0.dist-info/RECORD +927 -0
  925. asyncviz-0.1.0.dist-info/WHEEL +4 -0
  926. asyncviz-0.1.0.dist-info/entry_points.txt +2 -0
  927. asyncviz-0.1.0.dist-info/licenses/LICENSE +21 -0
asyncviz/__init__.py ADDED
@@ -0,0 +1,36 @@
1
+ from asyncviz.bootstrap import (
2
+ AsyncVizError,
3
+ AsyncVizRuntime,
4
+ ConfigError,
5
+ PortInUseError,
6
+ StartupError,
7
+ StartupTimeoutError,
8
+ get_runtime,
9
+ is_running,
10
+ start,
11
+ stop,
12
+ )
13
+ from asyncviz.config import AsyncVizConfig
14
+ from asyncviz.packaging import package_version
15
+
16
+ __all__ = [
17
+ "AsyncVizConfig",
18
+ "AsyncVizError",
19
+ "AsyncVizRuntime",
20
+ "ConfigError",
21
+ "PortInUseError",
22
+ "StartupError",
23
+ "StartupTimeoutError",
24
+ "get_runtime",
25
+ "is_running",
26
+ "start",
27
+ "stop",
28
+ ]
29
+
30
+ #: Resolved at import time from installed-distribution metadata when
31
+ #: available, falling back to the in-repo literal for editable /
32
+ #: source-tree usage. Single source of truth — never edit this string
33
+ #: directly; bump
34
+ #: :data:`asyncviz.packaging.versioning._FALLBACK_VERSION` together
35
+ #: with ``[project].version`` in ``pyproject.toml``.
36
+ __version__ = package_version()
asyncviz/__main__.py ADDED
@@ -0,0 +1,21 @@
1
+ """``python -m asyncviz`` entry point.
2
+
3
+ Delegates to the canonical CLI dispatcher in :mod:`asyncviz.cli`.
4
+ Kept tiny so a future plugin system can replace ``run_cli`` without
5
+ touching the module path users invoke from the shell.
6
+ """
7
+
8
+ from __future__ import annotations
9
+
10
+ import sys
11
+
12
+ from asyncviz.cli import run_cli
13
+
14
+
15
+ def main() -> int:
16
+ """Process entry point — returns the exit code without calling sys.exit."""
17
+ return run_cli()
18
+
19
+
20
+ if __name__ == "__main__":
21
+ sys.exit(main())
@@ -0,0 +1,143 @@
1
+ """Canonical AsyncViz benchmarking layer.
2
+
3
+ Public API:
4
+
5
+ * :func:`benchmark` — decorator for registering benchmarks.
6
+ * :class:`BenchmarkRunner` — orchestrates warmup + measurement.
7
+ * :class:`BenchmarkConfig` — runner configuration.
8
+ * :func:`run_all` — convenience for "run every registered benchmark".
9
+
10
+ Lower-level pieces live under the submodules (statistics, baselines,
11
+ reporting, profiling).
12
+ """
13
+
14
+ from asyncviz.benchmarks.benchmark_baselines import (
15
+ BaselineFile,
16
+ read_baseline,
17
+ write_baseline,
18
+ )
19
+ from asyncviz.benchmarks.benchmark_configuration import (
20
+ DEFAULT_MEASURED_ITERATIONS,
21
+ DEFAULT_REGRESSION_THRESHOLD,
22
+ DEFAULT_WARMUP_ITERATIONS,
23
+ BenchmarkConfig,
24
+ OutlierPolicy,
25
+ default_config,
26
+ quick_config,
27
+ )
28
+ from asyncviz.benchmarks.benchmark_diagnostics import (
29
+ BenchmarkDiagnostics,
30
+ build_benchmark_diagnostics,
31
+ )
32
+ from asyncviz.benchmarks.benchmark_models import (
33
+ BaselineComparison,
34
+ BenchmarkCategory,
35
+ BenchmarkEnvironment,
36
+ BenchmarkKind,
37
+ BenchmarkOutcome,
38
+ BenchmarkResult,
39
+ BenchmarkSample,
40
+ BenchmarkSpec,
41
+ BenchmarkStatistics,
42
+ BenchmarkSuiteResult,
43
+ )
44
+ from asyncviz.benchmarks.benchmark_observability import (
45
+ BenchmarkMetricsSnapshot,
46
+ get_benchmark_metrics,
47
+ get_benchmark_metrics_snapshot,
48
+ reset_benchmark_metrics,
49
+ )
50
+ from asyncviz.benchmarks.benchmark_registry import (
51
+ benchmark,
52
+ get_registry,
53
+ reset_registry,
54
+ )
55
+ from asyncviz.benchmarks.benchmark_runner import BenchmarkRunner
56
+ from asyncviz.benchmarks.benchmark_statistics import (
57
+ aggregate_samples,
58
+ apply_outlier_policy,
59
+ )
60
+ from asyncviz.benchmarks.benchmark_thresholds import (
61
+ RegressionSummary,
62
+ is_regression,
63
+ label_for,
64
+ summarize_regressions,
65
+ )
66
+ from asyncviz.benchmarks.benchmark_tracing import (
67
+ BenchmarkTraceEntry,
68
+ BenchmarkTraceKind,
69
+ clear_benchmark_trace,
70
+ get_benchmark_trace,
71
+ is_benchmark_trace_enabled,
72
+ record_benchmark_trace,
73
+ set_benchmark_trace_enabled,
74
+ )
75
+
76
+
77
+ def run_all(
78
+ *,
79
+ config: BenchmarkConfig | None = None,
80
+ baselines: dict[str, int] | None = None,
81
+ name_prefix: str | None = None,
82
+ category: BenchmarkCategory | None = None,
83
+ ) -> BenchmarkSuiteResult:
84
+ """Run every registered benchmark + return the suite result.
85
+
86
+ Filtering: ``name_prefix`` keeps only benchmarks whose names
87
+ start with the prefix; ``category`` restricts to a single
88
+ category. Both can be combined.
89
+ """
90
+ runner = BenchmarkRunner(config=config, baselines=baselines)
91
+ specs = get_registry().filtered(
92
+ category=category,
93
+ name_prefix=name_prefix,
94
+ )
95
+ return runner.run_suite(specs)
96
+
97
+
98
+ __all__ = [
99
+ "DEFAULT_MEASURED_ITERATIONS",
100
+ "DEFAULT_REGRESSION_THRESHOLD",
101
+ "DEFAULT_WARMUP_ITERATIONS",
102
+ "BaselineComparison",
103
+ "BaselineFile",
104
+ "BenchmarkCategory",
105
+ "BenchmarkConfig",
106
+ "BenchmarkDiagnostics",
107
+ "BenchmarkEnvironment",
108
+ "BenchmarkKind",
109
+ "BenchmarkMetricsSnapshot",
110
+ "BenchmarkOutcome",
111
+ "BenchmarkResult",
112
+ "BenchmarkRunner",
113
+ "BenchmarkSample",
114
+ "BenchmarkSpec",
115
+ "BenchmarkStatistics",
116
+ "BenchmarkSuiteResult",
117
+ "BenchmarkTraceEntry",
118
+ "BenchmarkTraceKind",
119
+ "OutlierPolicy",
120
+ "RegressionSummary",
121
+ "aggregate_samples",
122
+ "apply_outlier_policy",
123
+ "benchmark",
124
+ "build_benchmark_diagnostics",
125
+ "clear_benchmark_trace",
126
+ "default_config",
127
+ "get_benchmark_metrics",
128
+ "get_benchmark_metrics_snapshot",
129
+ "get_benchmark_trace",
130
+ "get_registry",
131
+ "is_benchmark_trace_enabled",
132
+ "is_regression",
133
+ "label_for",
134
+ "quick_config",
135
+ "read_baseline",
136
+ "record_benchmark_trace",
137
+ "reset_benchmark_metrics",
138
+ "reset_registry",
139
+ "run_all",
140
+ "set_benchmark_trace_enabled",
141
+ "summarize_regressions",
142
+ "write_baseline",
143
+ ]
@@ -0,0 +1,161 @@
1
+ """``python -m asyncviz.benchmarks`` — run the registered suite.
2
+
3
+ Usage::
4
+
5
+ python -m asyncviz.benchmarks
6
+ python -m asyncviz.benchmarks --quick
7
+ python -m asyncviz.benchmarks --category replay
8
+ python -m asyncviz.benchmarks --name-prefix instrumentation.
9
+ python -m asyncviz.benchmarks --json /tmp/bench.json --markdown /tmp/bench.md
10
+ python -m asyncviz.benchmarks --baseline /tmp/baseline.json
11
+ python -m asyncviz.benchmarks --write-baseline /tmp/baseline.json
12
+ python -m asyncviz.benchmarks --track-allocations
13
+ """
14
+
15
+ from __future__ import annotations
16
+
17
+ import argparse
18
+ import sys
19
+ from pathlib import Path
20
+
21
+ # Importing the benchmark categories registers their entries.
22
+ import asyncviz.benchmarks.instrumentation
23
+ import asyncviz.benchmarks.memory
24
+ import asyncviz.benchmarks.replay
25
+ import asyncviz.benchmarks.stress
26
+ import asyncviz.benchmarks.websocket # noqa: F401
27
+ from asyncviz.benchmarks import (
28
+ BenchmarkConfig,
29
+ default_config,
30
+ quick_config,
31
+ read_baseline,
32
+ run_all,
33
+ set_benchmark_trace_enabled,
34
+ summarize_regressions,
35
+ write_baseline,
36
+ )
37
+ from asyncviz.benchmarks.reporting import (
38
+ emit_ci_summary,
39
+ write_json_report,
40
+ write_markdown_report,
41
+ )
42
+
43
+
44
+ def _parse_args(argv: list[str] | None = None) -> argparse.Namespace:
45
+ parser = argparse.ArgumentParser(
46
+ prog="asyncviz.benchmarks",
47
+ description="Run AsyncViz benchmarks + emit reports.",
48
+ )
49
+ parser.add_argument(
50
+ "--quick",
51
+ action="store_true",
52
+ help="Use the quick benchmark config",
53
+ )
54
+ parser.add_argument("--category", default=None, help="Filter by category")
55
+ parser.add_argument(
56
+ "--name-prefix",
57
+ default=None,
58
+ help="Filter by name prefix",
59
+ )
60
+ parser.add_argument(
61
+ "--baseline",
62
+ type=Path,
63
+ default=None,
64
+ help="Compare against this baseline file",
65
+ )
66
+ parser.add_argument(
67
+ "--write-baseline",
68
+ type=Path,
69
+ default=None,
70
+ help="Write a new baseline after the run",
71
+ )
72
+ parser.add_argument(
73
+ "--json",
74
+ type=Path,
75
+ default=None,
76
+ help="Write full JSON report to this path",
77
+ )
78
+ parser.add_argument(
79
+ "--markdown",
80
+ type=Path,
81
+ default=None,
82
+ help="Write markdown summary to this path",
83
+ )
84
+ parser.add_argument(
85
+ "--trace",
86
+ action="store_true",
87
+ help="Enable benchmark tracing during the run",
88
+ )
89
+ parser.add_argument(
90
+ "--track-allocations",
91
+ action="store_true",
92
+ help="Capture per-sample tracemalloc deltas (slow)",
93
+ )
94
+ parser.add_argument(
95
+ "--fail-on-regression",
96
+ action="store_true",
97
+ help="Exit nonzero if any regression is detected vs baseline",
98
+ )
99
+ return parser.parse_args(argv)
100
+
101
+
102
+ def _resolve_config(args: argparse.Namespace) -> BenchmarkConfig:
103
+ base = quick_config() if args.quick else default_config()
104
+ return BenchmarkConfig(
105
+ warmup_iterations=base.warmup_iterations,
106
+ measured_iterations=base.measured_iterations,
107
+ min_samples=base.min_samples,
108
+ outlier_policy=base.outlier_policy,
109
+ mad_threshold=base.mad_threshold,
110
+ iqr_factor=base.iqr_factor,
111
+ regression_threshold=base.regression_threshold,
112
+ report_percentiles=base.report_percentiles,
113
+ disable_gc_during_run=base.disable_gc_during_run,
114
+ isolate_per_benchmark=base.isolate_per_benchmark,
115
+ track_allocations=args.track_allocations,
116
+ deterministic_seed=base.deterministic_seed,
117
+ fail_on_regression=args.fail_on_regression,
118
+ extras=dict(base.extras),
119
+ )
120
+
121
+
122
+ def main(argv: list[str] | None = None) -> int:
123
+ args = _parse_args(argv)
124
+ if args.trace:
125
+ set_benchmark_trace_enabled(True)
126
+
127
+ config = _resolve_config(args)
128
+ baselines = None
129
+ if args.baseline is not None:
130
+ bf = read_baseline(args.baseline)
131
+ if bf is not None:
132
+ baselines = bf.p95_ns_by_name
133
+
134
+ suite = run_all(
135
+ config=config,
136
+ baselines=baselines,
137
+ name_prefix=args.name_prefix,
138
+ category=args.category, # type: ignore[arg-type]
139
+ )
140
+
141
+ for line in emit_ci_summary(suite):
142
+ print(line)
143
+
144
+ if args.json is not None:
145
+ write_json_report(args.json, suite)
146
+ print(f"json report → {args.json}")
147
+ if args.markdown is not None:
148
+ write_markdown_report(args.markdown, suite)
149
+ print(f"markdown report → {args.markdown}")
150
+ if args.write_baseline is not None:
151
+ write_baseline(args.write_baseline, suite)
152
+ print(f"baseline → {args.write_baseline}")
153
+
154
+ summary = summarize_regressions(suite)
155
+ if args.fail_on_regression and summary.regressed > 0:
156
+ return 1
157
+ return 0
158
+
159
+
160
+ if __name__ == "__main__":
161
+ sys.exit(main())
@@ -0,0 +1,82 @@
1
+ """Baseline persistence + comparison.
2
+
3
+ A baseline is a JSON file mapping benchmark names → p95 ns. The
4
+ runner consumes this via :meth:`BenchmarkRunner.set_baselines`; the
5
+ CLI writes one out after a clean run so subsequent runs have
6
+ something to compare against.
7
+ """
8
+
9
+ from __future__ import annotations
10
+
11
+ import json
12
+ import time
13
+ from dataclasses import dataclass, field
14
+ from pathlib import Path
15
+
16
+ from asyncviz.benchmarks.benchmark_models import BenchmarkSuiteResult
17
+
18
+ BASELINE_SCHEMA_VERSION = 1
19
+
20
+
21
+ @dataclass(frozen=True, slots=True)
22
+ class BaselineFile:
23
+ """Parsed view of a baseline JSON."""
24
+
25
+ schema_version: int
26
+ captured_at_wall_ns: int
27
+ asyncviz_version: str
28
+ p95_ns_by_name: dict[str, int]
29
+ metadata: dict[str, str] = field(default_factory=dict)
30
+
31
+ def get(self, name: str) -> int | None:
32
+ return self.p95_ns_by_name.get(name)
33
+
34
+
35
+ def write_baseline(
36
+ path: Path,
37
+ suite: BenchmarkSuiteResult,
38
+ *,
39
+ metadata: dict[str, str] | None = None,
40
+ ) -> BaselineFile:
41
+ """Build a baseline file from a suite result + persist it."""
42
+ p95_map = {
43
+ result.outcome.spec_name: result.outcome.statistics.p95_ns
44
+ for result in suite.results
45
+ if result.outcome.statistics is not None and result.outcome.status == "ok"
46
+ }
47
+ baseline = BaselineFile(
48
+ schema_version=BASELINE_SCHEMA_VERSION,
49
+ captured_at_wall_ns=time.time_ns(),
50
+ asyncviz_version=suite.environment.asyncviz_version,
51
+ p95_ns_by_name=p95_map,
52
+ metadata=dict(metadata or {}),
53
+ )
54
+ path.parent.mkdir(parents=True, exist_ok=True)
55
+ payload = {
56
+ "schema_version": baseline.schema_version,
57
+ "captured_at_wall_ns": baseline.captured_at_wall_ns,
58
+ "asyncviz_version": baseline.asyncviz_version,
59
+ "p95_ns_by_name": baseline.p95_ns_by_name,
60
+ "metadata": baseline.metadata,
61
+ }
62
+ path.write_text(json.dumps(payload, indent=2, sort_keys=True), encoding="utf-8")
63
+ return baseline
64
+
65
+
66
+ def read_baseline(path: Path) -> BaselineFile | None:
67
+ """Read a baseline file. Returns ``None`` if missing."""
68
+ if not path.exists():
69
+ return None
70
+ raw = json.loads(path.read_text(encoding="utf-8"))
71
+ schema = int(raw.get("schema_version", 0))
72
+ if schema != BASELINE_SCHEMA_VERSION:
73
+ raise ValueError(
74
+ f"baseline at {path} has schema_version={schema} (expected {BASELINE_SCHEMA_VERSION})",
75
+ )
76
+ return BaselineFile(
77
+ schema_version=schema,
78
+ captured_at_wall_ns=int(raw.get("captured_at_wall_ns", 0)),
79
+ asyncviz_version=str(raw.get("asyncviz_version", "")),
80
+ p95_ns_by_name={str(k): int(v) for k, v in raw.get("p95_ns_by_name", {}).items()},
81
+ metadata={str(k): str(v) for k, v in raw.get("metadata", {}).items()},
82
+ )
@@ -0,0 +1,105 @@
1
+ """Benchmark configuration.
2
+
3
+ Centralizes every knob the runner cares about: warmup discipline,
4
+ sample counts, statistical rigor (outlier policy, minimum-sample
5
+ floor), default regression thresholds. Tests construct purpose-built
6
+ configs; the production CLI uses :func:`default_config`.
7
+ """
8
+
9
+ from __future__ import annotations
10
+
11
+ from dataclasses import dataclass, field
12
+ from typing import Final, Literal
13
+
14
+ OutlierPolicy = Literal["none", "mad", "iqr"]
15
+ """How outliers are excluded from the reported statistics.
16
+
17
+ * ``none`` — keep every sample.
18
+ * ``mad`` (default) — drop samples beyond a configured number of
19
+ median-absolute-deviations from the median. Stable under skewed
20
+ distributions where mean/stdev would mislead.
21
+ * ``iqr`` — Tukey's IQR fence.
22
+ """
23
+
24
+ DEFAULT_WARMUP_ITERATIONS: Final[int] = 50
25
+ DEFAULT_MEASURED_ITERATIONS: Final[int] = 500
26
+ DEFAULT_MIN_SAMPLES: Final[int] = 25
27
+ """Hard floor — a benchmark with fewer surviving samples than this
28
+ is flagged as ``insufficient`` rather than reported with bogus
29
+ statistics."""
30
+
31
+ DEFAULT_REGRESSION_THRESHOLD: Final[float] = 0.15
32
+ """Default ±15% p95 swing before a regression is declared."""
33
+
34
+ DEFAULT_REPORT_PERCENTILES: Final[tuple[float, ...]] = (50.0, 95.0, 99.0)
35
+
36
+
37
+ @dataclass(frozen=True, slots=True)
38
+ class BenchmarkConfig:
39
+ """Immutable benchmark-runner configuration."""
40
+
41
+ warmup_iterations: int = DEFAULT_WARMUP_ITERATIONS
42
+ measured_iterations: int = DEFAULT_MEASURED_ITERATIONS
43
+ min_samples: int = DEFAULT_MIN_SAMPLES
44
+
45
+ outlier_policy: OutlierPolicy = "mad"
46
+ mad_threshold: float = 3.5
47
+ """Number of MADs from the median to keep a sample."""
48
+
49
+ iqr_factor: float = 1.5
50
+
51
+ regression_threshold: float = DEFAULT_REGRESSION_THRESHOLD
52
+
53
+ report_percentiles: tuple[float, ...] = DEFAULT_REPORT_PERCENTILES
54
+
55
+ disable_gc_during_run: bool = True
56
+ """Disable Python's cyclic GC while measuring so allocation
57
+ spikes from cycle collection don't pollute timing samples."""
58
+
59
+ isolate_per_benchmark: bool = True
60
+ """Force a full GC + counter reset between benchmarks so one
61
+ workload's tail allocations don't affect the next."""
62
+
63
+ track_allocations: bool = False
64
+ """When True, every sample also captures
65
+ :func:`tracemalloc.take_snapshot` deltas — slows the run."""
66
+
67
+ deterministic_seed: int = 0xA5_BE_F7
68
+ """Seed used for the synthetic workloads' random number streams."""
69
+
70
+ fail_on_regression: bool = False
71
+ """When True, the suite returns a nonzero exit code on regression.
72
+ Off by default — informative, not enforcing — until baselines
73
+ are established."""
74
+
75
+ extras: dict[str, str] = field(default_factory=dict)
76
+ """Free-form notes for downstream tooling."""
77
+
78
+ def __post_init__(self) -> None:
79
+ if self.warmup_iterations < 0:
80
+ raise ValueError("warmup_iterations must be >= 0")
81
+ if self.measured_iterations < 1:
82
+ raise ValueError("measured_iterations must be >= 1")
83
+ if self.min_samples < 1:
84
+ raise ValueError("min_samples must be >= 1")
85
+ if not (0.0 < self.regression_threshold < 10.0):
86
+ raise ValueError(
87
+ f"regression_threshold {self.regression_threshold} must be in (0, 10)",
88
+ )
89
+ if self.outlier_policy == "mad" and self.mad_threshold <= 0:
90
+ raise ValueError("mad_threshold must be > 0")
91
+ if self.outlier_policy == "iqr" and self.iqr_factor <= 0:
92
+ raise ValueError("iqr_factor must be > 0")
93
+
94
+
95
+ def default_config() -> BenchmarkConfig:
96
+ return BenchmarkConfig()
97
+
98
+
99
+ def quick_config() -> BenchmarkConfig:
100
+ """Faster config for smoke tests + CI sanity runs."""
101
+ return BenchmarkConfig(
102
+ warmup_iterations=10,
103
+ measured_iterations=50,
104
+ min_samples=10,
105
+ )
@@ -0,0 +1,44 @@
1
+ """Diagnostics builder for the benchmark layer."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from dataclasses import dataclass
6
+
7
+ from asyncviz.benchmarks.benchmark_models import BenchmarkSuiteResult
8
+ from asyncviz.benchmarks.benchmark_observability import (
9
+ BenchmarkMetricsSnapshot,
10
+ get_benchmark_metrics_snapshot,
11
+ )
12
+ from asyncviz.benchmarks.benchmark_thresholds import (
13
+ RegressionSummary,
14
+ summarize_regressions,
15
+ )
16
+ from asyncviz.benchmarks.benchmark_tracing import (
17
+ BenchmarkTraceEntry,
18
+ get_benchmark_trace,
19
+ is_benchmark_trace_enabled,
20
+ )
21
+
22
+
23
+ @dataclass(frozen=True, slots=True)
24
+ class BenchmarkDiagnostics:
25
+ metrics: BenchmarkMetricsSnapshot
26
+ regression: RegressionSummary | None
27
+ trace_enabled: bool
28
+ recent_trace: tuple[BenchmarkTraceEntry, ...]
29
+
30
+
31
+ def build_benchmark_diagnostics(
32
+ suite: BenchmarkSuiteResult | None = None,
33
+ *,
34
+ trace_limit: int = 32,
35
+ ) -> BenchmarkDiagnostics:
36
+ trace = get_benchmark_trace()
37
+ if trace_limit > 0:
38
+ trace = trace[-trace_limit:]
39
+ return BenchmarkDiagnostics(
40
+ metrics=get_benchmark_metrics_snapshot(),
41
+ regression=summarize_regressions(suite) if suite is not None else None,
42
+ trace_enabled=is_benchmark_trace_enabled(),
43
+ recent_trace=trace,
44
+ )