chalk-remote-call-python 1.10.4__tar.gz → 1.10.5__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. {chalk_remote_call_python-1.10.4/chalk_remote_call_python.egg-info → chalk_remote_call_python-1.10.5}/PKG-INFO +23 -4
  2. {chalk_remote_call_python-1.10.4 → chalk_remote_call_python-1.10.5}/README.md +20 -2
  3. {chalk_remote_call_python-1.10.4 → chalk_remote_call_python-1.10.5}/chalk-remote-call-rs/Cargo.lock +11 -38
  4. {chalk_remote_call_python-1.10.4 → chalk_remote_call_python-1.10.5}/chalk-remote-call-rs/chalk-remote-call-server/Cargo.toml +9 -1
  5. {chalk_remote_call_python-1.10.4 → chalk_remote_call_python-1.10.5}/chalk-remote-call-rs/chalk-remote-call-server/src/coalesce.rs +13 -13
  6. {chalk_remote_call_python-1.10.4 → chalk_remote_call_python-1.10.5}/chalk-remote-call-rs/chalk-remote-call-server/src/lib.rs +14 -6
  7. chalk_remote_call_python-1.10.5/chalk-remote-call-rs/chalk-remote-call-server/src/metrics.rs +423 -0
  8. {chalk_remote_call_python-1.10.4 → chalk_remote_call_python-1.10.5}/chalk-remote-call-rs/chalk-remote-call-server/src/self_consumer.rs +23 -23
  9. {chalk_remote_call_python-1.10.4 → chalk_remote_call_python-1.10.5}/chalk-remote-call-rs/chalk-remote-call-server/src/server.rs +5 -5
  10. {chalk_remote_call_python-1.10.4 → chalk_remote_call_python-1.10.5}/chalk-remote-call-rs/chalk-remote-call-server/src/service.rs +6 -6
  11. {chalk_remote_call_python-1.10.4 → chalk_remote_call_python-1.10.5}/chalk-remote-call-rs/rust-toolchain.toml +1 -1
  12. chalk_remote_call_python-1.10.5/chalk_remote_call/_version.py +1 -0
  13. {chalk_remote_call_python-1.10.4 → chalk_remote_call_python-1.10.5}/chalk_remote_call/arrow_utils.py +6 -2
  14. {chalk_remote_call_python-1.10.4 → chalk_remote_call_python-1.10.5}/chalk_remote_call/errors.py +16 -0
  15. {chalk_remote_call_python-1.10.4 → chalk_remote_call_python-1.10.5}/chalk_remote_call/servicer.py +26 -49
  16. {chalk_remote_call_python-1.10.4 → chalk_remote_call_python-1.10.5}/chalk_remote_call/tracing.py +102 -20
  17. {chalk_remote_call_python-1.10.4 → chalk_remote_call_python-1.10.5/chalk_remote_call_python.egg-info}/PKG-INFO +23 -4
  18. {chalk_remote_call_python-1.10.4 → chalk_remote_call_python-1.10.5}/pyproject.toml +2 -1
  19. chalk_remote_call_python-1.10.4/chalk-remote-call-rs/chalk-remote-call-server/src/metrics.rs +0 -149
  20. chalk_remote_call_python-1.10.4/chalk_remote_call/_version.py +0 -1
  21. {chalk_remote_call_python-1.10.4 → chalk_remote_call_python-1.10.5}/MANIFEST.in +0 -0
  22. {chalk_remote_call_python-1.10.4 → chalk_remote_call_python-1.10.5}/chalk-remote-call-rs/Cargo.toml +0 -0
  23. {chalk_remote_call_python-1.10.4 → chalk_remote_call_python-1.10.5}/chalk-remote-call-rs/chalk-remote-call-proto/Cargo.toml +0 -0
  24. {chalk_remote_call_python-1.10.4 → chalk_remote_call_python-1.10.5}/chalk-remote-call-rs/chalk-remote-call-proto/src/gen/chalk.auth.v1.rs +0 -0
  25. {chalk_remote_call_python-1.10.4 → chalk_remote_call_python-1.10.5}/chalk-remote-call-rs/chalk-remote-call-proto/src/gen/chalk.common.v1.rs +0 -0
  26. {chalk_remote_call_python-1.10.4 → chalk_remote_call_python-1.10.5}/chalk-remote-call-rs/chalk-remote-call-proto/src/gen/chalk.runtime.v1.rs +0 -0
  27. {chalk_remote_call_python-1.10.4 → chalk_remote_call_python-1.10.5}/chalk-remote-call-rs/chalk-remote-call-proto/src/gen/chalk.runtime.v1.tonic.rs +0 -0
  28. {chalk_remote_call_python-1.10.4 → chalk_remote_call_python-1.10.5}/chalk-remote-call-rs/chalk-remote-call-proto/src/gen/chalk.utils.v1.rs +0 -0
  29. {chalk_remote_call_python-1.10.4 → chalk_remote_call_python-1.10.5}/chalk-remote-call-rs/chalk-remote-call-proto/src/gen/descriptor.bin +0 -0
  30. {chalk_remote_call_python-1.10.4 → chalk_remote_call_python-1.10.5}/chalk-remote-call-rs/chalk-remote-call-proto/src/lib.rs +0 -0
  31. {chalk_remote_call_python-1.10.4 → chalk_remote_call_python-1.10.5}/chalk-remote-call-rs/chalk-remote-call-server/src/async_service.rs +0 -0
  32. {chalk_remote_call_python-1.10.4 → chalk_remote_call_python-1.10.5}/chalk-remote-call-rs/chalk-remote-call-server/src/fnq_client.rs +0 -0
  33. {chalk_remote_call_python-1.10.4 → chalk_remote_call_python-1.10.5}/chalk-remote-call-rs/chalk-remote-call-server/src/python_bridge.rs +0 -0
  34. {chalk_remote_call_python-1.10.4 → chalk_remote_call_python-1.10.5}/chalk_remote_call/__init__.py +0 -0
  35. {chalk_remote_call_python-1.10.4 → chalk_remote_call_python-1.10.5}/chalk_remote_call/__main__.py +0 -0
  36. {chalk_remote_call_python-1.10.4 → chalk_remote_call_python-1.10.5}/chalk_remote_call/_gen/__init__.py +0 -0
  37. {chalk_remote_call_python-1.10.4 → chalk_remote_call_python-1.10.5}/chalk_remote_call/_gen/chalk/__init__.py +0 -0
  38. {chalk_remote_call_python-1.10.4 → chalk_remote_call_python-1.10.5}/chalk_remote_call/_gen/chalk/auth/__init__.py +0 -0
  39. {chalk_remote_call_python-1.10.4 → chalk_remote_call_python-1.10.5}/chalk_remote_call/_gen/chalk/auth/v1/__init__.py +0 -0
  40. {chalk_remote_call_python-1.10.4 → chalk_remote_call_python-1.10.5}/chalk_remote_call/_gen/chalk/auth/v1/permissions_pb2.py +0 -0
  41. {chalk_remote_call_python-1.10.4 → chalk_remote_call_python-1.10.5}/chalk_remote_call/_gen/chalk/auth/v1/permissions_pb2_grpc.py +0 -0
  42. {chalk_remote_call_python-1.10.4 → chalk_remote_call_python-1.10.5}/chalk_remote_call/_gen/chalk/common/__init__.py +0 -0
  43. {chalk_remote_call_python-1.10.4 → chalk_remote_call_python-1.10.5}/chalk_remote_call/_gen/chalk/common/v1/__init__.py +0 -0
  44. {chalk_remote_call_python-1.10.4 → chalk_remote_call_python-1.10.5}/chalk_remote_call/_gen/chalk/common/v1/chalk_error_pb2.py +0 -0
  45. {chalk_remote_call_python-1.10.4 → chalk_remote_call_python-1.10.5}/chalk_remote_call/_gen/chalk/common/v1/chalk_error_pb2_grpc.py +0 -0
  46. {chalk_remote_call_python-1.10.4 → chalk_remote_call_python-1.10.5}/chalk_remote_call/_gen/chalk/runtime/__init__.py +0 -0
  47. {chalk_remote_call_python-1.10.4 → chalk_remote_call_python-1.10.5}/chalk_remote_call/_gen/chalk/runtime/v1/__init__.py +0 -0
  48. {chalk_remote_call_python-1.10.4 → chalk_remote_call_python-1.10.5}/chalk_remote_call/_gen/chalk/runtime/v1/fnq_consumer_pb2.py +0 -0
  49. {chalk_remote_call_python-1.10.4 → chalk_remote_call_python-1.10.5}/chalk_remote_call/_gen/chalk/runtime/v1/fnq_consumer_pb2_grpc.py +0 -0
  50. {chalk_remote_call_python-1.10.4 → chalk_remote_call_python-1.10.5}/chalk_remote_call/_gen/chalk/runtime/v1/remote_python_call_pb2.py +0 -0
  51. {chalk_remote_call_python-1.10.4 → chalk_remote_call_python-1.10.5}/chalk_remote_call/_gen/chalk/runtime/v1/remote_python_call_pb2_grpc.py +0 -0
  52. {chalk_remote_call_python-1.10.4 → chalk_remote_call_python-1.10.5}/chalk_remote_call/_gen/chalk/utils/__init__.py +0 -0
  53. {chalk_remote_call_python-1.10.4 → chalk_remote_call_python-1.10.5}/chalk_remote_call/_gen/chalk/utils/v1/__init__.py +0 -0
  54. {chalk_remote_call_python-1.10.4 → chalk_remote_call_python-1.10.5}/chalk_remote_call/_gen/chalk/utils/v1/encoding_pb2.py +0 -0
  55. {chalk_remote_call_python-1.10.4 → chalk_remote_call_python-1.10.5}/chalk_remote_call/_gen/chalk/utils/v1/encoding_pb2_grpc.py +0 -0
  56. {chalk_remote_call_python-1.10.4 → chalk_remote_call_python-1.10.5}/chalk_remote_call/_gen/chalk/utils/v1/field_change_pb2.py +0 -0
  57. {chalk_remote_call_python-1.10.4 → chalk_remote_call_python-1.10.5}/chalk_remote_call/_gen/chalk/utils/v1/field_change_pb2_grpc.py +0 -0
  58. {chalk_remote_call_python-1.10.4 → chalk_remote_call_python-1.10.5}/chalk_remote_call/_gen/chalk/utils/v1/large_pb2.py +0 -0
  59. {chalk_remote_call_python-1.10.4 → chalk_remote_call_python-1.10.5}/chalk_remote_call/_gen/chalk/utils/v1/large_pb2_grpc.py +0 -0
  60. {chalk_remote_call_python-1.10.4 → chalk_remote_call_python-1.10.5}/chalk_remote_call/_gen/chalk/utils/v1/sensitive_pb2.py +0 -0
  61. {chalk_remote_call_python-1.10.4 → chalk_remote_call_python-1.10.5}/chalk_remote_call/_gen/chalk/utils/v1/sensitive_pb2_grpc.py +0 -0
  62. {chalk_remote_call_python-1.10.4 → chalk_remote_call_python-1.10.5}/chalk_remote_call/_native.pyi +0 -0
  63. {chalk_remote_call_python-1.10.4 → chalk_remote_call_python-1.10.5}/chalk_remote_call/cli.py +0 -0
  64. {chalk_remote_call_python-1.10.4 → chalk_remote_call_python-1.10.5}/chalk_remote_call/handler_loader.py +0 -0
  65. {chalk_remote_call_python-1.10.4 → chalk_remote_call_python-1.10.5}/chalk_remote_call/input_transform.py +0 -0
  66. {chalk_remote_call_python-1.10.4 → chalk_remote_call_python-1.10.5}/chalk_remote_call/logging.py +0 -0
  67. {chalk_remote_call_python-1.10.4 → chalk_remote_call_python-1.10.5}/chalk_remote_call/server.py +0 -0
  68. {chalk_remote_call_python-1.10.4 → chalk_remote_call_python-1.10.5}/chalk_remote_call_python.egg-info/SOURCES.txt +0 -0
  69. {chalk_remote_call_python-1.10.4 → chalk_remote_call_python-1.10.5}/chalk_remote_call_python.egg-info/dependency_links.txt +0 -0
  70. {chalk_remote_call_python-1.10.4 → chalk_remote_call_python-1.10.5}/chalk_remote_call_python.egg-info/entry_points.txt +0 -0
  71. {chalk_remote_call_python-1.10.4 → chalk_remote_call_python-1.10.5}/chalk_remote_call_python.egg-info/requires.txt +0 -0
  72. {chalk_remote_call_python-1.10.4 → chalk_remote_call_python-1.10.5}/chalk_remote_call_python.egg-info/top_level.txt +0 -0
  73. {chalk_remote_call_python-1.10.4 → chalk_remote_call_python-1.10.5}/setup.cfg +0 -0
  74. {chalk_remote_call_python-1.10.4 → chalk_remote_call_python-1.10.5}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: chalk-remote-call-python
3
- Version: 1.10.4
3
+ Version: 1.10.5
4
4
  Summary: Chalk remote call Python runtime interface client
5
5
  Author: Chalk AI, Inc.
6
6
  Project-URL: Homepage, https://chalk.ai
@@ -12,6 +12,7 @@ Classifier: Programming Language :: Python :: 3.11
12
12
  Classifier: Programming Language :: Python :: 3.12
13
13
  Classifier: Programming Language :: Python :: 3.13
14
14
  Classifier: Programming Language :: Python :: 3.14
15
+ Classifier: Programming Language :: Python :: 3.15
15
16
  Classifier: Programming Language :: Python
16
17
  Classifier: Typing :: Typed
17
18
  Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
@@ -19,7 +20,7 @@ Classifier: Topic :: Scientific/Engineering :: Information Analysis
19
20
  Classifier: Topic :: Software Development :: Code Generators
20
21
  Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
21
22
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
22
- Requires-Python: <3.15,>=3.10
23
+ Requires-Python: <3.16,>=3.10
23
24
  Description-Content-Type: text/markdown
24
25
  Requires-Dist: pyarrow>=14.0.0
25
26
  Provides-Extra: dev
@@ -45,7 +46,7 @@ The server receives Arrow IPC record batches over a bidirectional gRPC stream, t
45
46
  ## Requirements
46
47
 
47
48
  - Python >= 3.10
48
- - Rust toolchain (for building the native extension)
49
+ - Rust 1.99.0 (for building the native extension)
49
50
  - `pyarrow >= 14.0.0`
50
51
 
51
52
  ## Usage
@@ -116,6 +117,12 @@ invalid environment configuration, and exceptions escaping startup or the server
116
117
  emit a single ERROR record with the full traceback and exit with status 1.
117
118
  Calls to `serve()` from Python retain the embedding application's logging configuration.
118
119
 
120
+ On Linux, server shutdown drains buffered function-call metrics before the runtime exits,
121
+ including when the server returns an error. Draining waits up to 10 seconds; a timeout or
122
+ publisher failure is logged as a warning.
123
+ Routine drain messages are logged at DEBUG; set `RUST_LOG=info,_native::metrics=debug`
124
+ to include them.
125
+
119
126
  Missing optional StatsD endpoints or a metrics-bus topic do not emit warnings.
120
127
  Failures initializing configured metrics sinks still warn. Routine customer
121
128
  StatsD configuration messages are emitted at DEBUG by the shared metrics library;
@@ -218,6 +225,15 @@ uv pip install -e ".[dev]"
218
225
  pytest tests/ -v
219
226
  ```
220
227
 
228
+ The Linux metrics shutdown regression tests use an in-memory bus publisher:
229
+
230
+ ```bash
231
+ PYO3_PYTHON=python3 cargo test --manifest-path chalk-remote-call-rs/chalk-remote-call-server/Cargo.toml --no-default-features --lib metrics::tests
232
+ ```
233
+
234
+ `--no-default-features` links Python into the test executable; wheel builds retain
235
+ the default `extension-module` feature.
236
+
221
237
  ### Rust code
222
238
 
223
239
  Rust source lives in `chalk-remote-call-rs/`:
@@ -232,7 +248,10 @@ PYO3_PYTHON=python3 cargo check --manifest-path chalk-remote-call-rs/chalk-remot
232
248
 
233
249
  Handler failures retain their original exception type, message, traceback,
234
250
  exception chains, and exception groups. Runtime dispatch frames are excluded
235
- from the user traceback; full diagnostics are retained in server logs.
251
+ from the user traceback, along with callers above the handler dispatch boundary.
252
+ Handler frames and their downstream calls remain visible (except for Chalk SDK
253
+ and marked generated dispatch frames); full diagnostics are retained in server
254
+ logs and `internal_stacktrace`.
236
255
 
237
256
  All call modes carry a JSON payload with `chalk_remote_error: 1` and an
238
257
  `exception` object containing the `ChalkException` fields `kind`, `message`,
@@ -7,7 +7,7 @@ The server receives Arrow IPC record batches over a bidirectional gRPC stream, t
7
7
  ## Requirements
8
8
 
9
9
  - Python >= 3.10
10
- - Rust toolchain (for building the native extension)
10
+ - Rust 1.99.0 (for building the native extension)
11
11
  - `pyarrow >= 14.0.0`
12
12
 
13
13
  ## Usage
@@ -78,6 +78,12 @@ invalid environment configuration, and exceptions escaping startup or the server
78
78
  emit a single ERROR record with the full traceback and exit with status 1.
79
79
  Calls to `serve()` from Python retain the embedding application's logging configuration.
80
80
 
81
+ On Linux, server shutdown drains buffered function-call metrics before the runtime exits,
82
+ including when the server returns an error. Draining waits up to 10 seconds; a timeout or
83
+ publisher failure is logged as a warning.
84
+ Routine drain messages are logged at DEBUG; set `RUST_LOG=info,_native::metrics=debug`
85
+ to include them.
86
+
81
87
  Missing optional StatsD endpoints or a metrics-bus topic do not emit warnings.
82
88
  Failures initializing configured metrics sinks still warn. Routine customer
83
89
  StatsD configuration messages are emitted at DEBUG by the shared metrics library;
@@ -180,6 +186,15 @@ uv pip install -e ".[dev]"
180
186
  pytest tests/ -v
181
187
  ```
182
188
 
189
+ The Linux metrics shutdown regression tests use an in-memory bus publisher:
190
+
191
+ ```bash
192
+ PYO3_PYTHON=python3 cargo test --manifest-path chalk-remote-call-rs/chalk-remote-call-server/Cargo.toml --no-default-features --lib metrics::tests
193
+ ```
194
+
195
+ `--no-default-features` links Python into the test executable; wheel builds retain
196
+ the default `extension-module` feature.
197
+
183
198
  ### Rust code
184
199
 
185
200
  Rust source lives in `chalk-remote-call-rs/`:
@@ -194,7 +209,10 @@ PYO3_PYTHON=python3 cargo check --manifest-path chalk-remote-call-rs/chalk-remot
194
209
 
195
210
  Handler failures retain their original exception type, message, traceback,
196
211
  exception chains, and exception groups. Runtime dispatch frames are excluded
197
- from the user traceback; full diagnostics are retained in server logs.
212
+ from the user traceback, along with callers above the handler dispatch boundary.
213
+ Handler frames and their downstream calls remain visible (except for Chalk SDK
214
+ and marked generated dispatch frames); full diagnostics are retained in server
215
+ logs and `internal_stacktrace`.
198
216
 
199
217
  All call modes carry a JSON payload with `chalk_remote_error: 1` and an
200
218
  `exception` object containing the `ChalkException` fields `kind`, `message`,
@@ -537,6 +537,7 @@ name = "chalk-remote-call-server"
537
537
  version = "0.1.0"
538
538
  dependencies = [
539
539
  "arrow",
540
+ "async-trait",
540
541
  "base64 0.22.1",
541
542
  "bytes",
542
543
  "chalk-queue",
@@ -1635,15 +1636,6 @@ dependencies = [
1635
1636
  "serde_core",
1636
1637
  ]
1637
1638
 
1638
- [[package]]
1639
- name = "indoc"
1640
- version = "2.0.7"
1641
- source = "registry+https://github.com/rust-lang/crates.io-index"
1642
- checksum = "79cf5c93f93228cf8efb3ba362535fb11199ac548a09ce117c9b1adc3030d706"
1643
- dependencies = [
1644
- "rustversion",
1645
- ]
1646
-
1647
1639
  [[package]]
1648
1640
  name = "ipnet"
1649
1641
  version = "2.12.0"
@@ -1857,15 +1849,6 @@ version = "2.8.0"
1857
1849
  source = "registry+https://github.com/rust-lang/crates.io-index"
1858
1850
  checksum = "f8ca58f447f06ed17d5fc4043ce1b10dd205e060fb3ce5b979b8ed8e59ff3f79"
1859
1851
 
1860
- [[package]]
1861
- name = "memoffset"
1862
- version = "0.9.1"
1863
- source = "registry+https://github.com/rust-lang/crates.io-index"
1864
- checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a"
1865
- dependencies = [
1866
- "autocfg",
1867
- ]
1868
-
1869
1852
  [[package]]
1870
1853
  name = "metrics-generator"
1871
1854
  version = "0.1.0"
@@ -2403,35 +2386,32 @@ dependencies = [
2403
2386
 
2404
2387
  [[package]]
2405
2388
  name = "pyo3"
2406
- version = "0.27.1"
2389
+ version = "0.29.3"
2407
2390
  source = "registry+https://github.com/rust-lang/crates.io-index"
2408
- checksum = "37a6df7eab65fc7bee654a421404947e10a0f7085b6951bf2ea395f4659fb0cf"
2391
+ checksum = "700d18fa267b73b9b521fd7e13580e2f446916f176cacee1ab63fcc8191f1655"
2409
2392
  dependencies = [
2410
- "indoc",
2411
2393
  "libc",
2412
- "memoffset",
2413
2394
  "once_cell",
2414
2395
  "portable-atomic",
2415
2396
  "pyo3-build-config",
2416
2397
  "pyo3-ffi",
2417
2398
  "pyo3-macros",
2418
- "unindent",
2419
2399
  ]
2420
2400
 
2421
2401
  [[package]]
2422
2402
  name = "pyo3-build-config"
2423
- version = "0.27.1"
2403
+ version = "0.29.3"
2424
2404
  source = "registry+https://github.com/rust-lang/crates.io-index"
2425
- checksum = "f77d387774f6f6eec64a004eac0ed525aab7fa1966d94b42f743797b3e395afb"
2405
+ checksum = "7b3fc0c4d08f6bb10e71fe39dfb9e2f59c6eb6854e22ec8092f50c69a4499adb"
2426
2406
  dependencies = [
2427
2407
  "target-lexicon",
2428
2408
  ]
2429
2409
 
2430
2410
  [[package]]
2431
2411
  name = "pyo3-ffi"
2432
- version = "0.27.1"
2412
+ version = "0.29.3"
2433
2413
  source = "registry+https://github.com/rust-lang/crates.io-index"
2434
- checksum = "2dd13844a4242793e02df3e2ec093f540d948299a6a77ea9ce7afd8623f542be"
2414
+ checksum = "dfc0b8e19df29aad7086cf977bb0c2a2f143e30567eb113e9cf72b62ca698330"
2435
2415
  dependencies = [
2436
2416
  "libc",
2437
2417
  "pyo3-build-config",
@@ -2439,9 +2419,9 @@ dependencies = [
2439
2419
 
2440
2420
  [[package]]
2441
2421
  name = "pyo3-macros"
2442
- version = "0.27.1"
2422
+ version = "0.29.3"
2443
2423
  source = "registry+https://github.com/rust-lang/crates.io-index"
2444
- checksum = "eaf8f9f1108270b90d3676b8679586385430e5c0bb78bb5f043f95499c821a71"
2424
+ checksum = "6100e8a4b5eba53afaa5ed078364851a0b2499c553a44c31026b929049b49dc6"
2445
2425
  dependencies = [
2446
2426
  "proc-macro2",
2447
2427
  "pyo3-macros-backend",
@@ -2451,13 +2431,12 @@ dependencies = [
2451
2431
 
2452
2432
  [[package]]
2453
2433
  name = "pyo3-macros-backend"
2454
- version = "0.27.1"
2434
+ version = "0.29.3"
2455
2435
  source = "registry+https://github.com/rust-lang/crates.io-index"
2456
- checksum = "70a3b2274450ba5288bc9b8c1b69ff569d1d61189d4bff38f8d22e03d17f932b"
2436
+ checksum = "6143877a16e82b5a727b7127ff4cd86858a24a28d745d72f43e6f227c7b1bdb3"
2457
2437
  dependencies = [
2458
2438
  "heck 0.5.0",
2459
2439
  "proc-macro2",
2460
- "pyo3-build-config",
2461
2440
  "quote",
2462
2441
  "syn 2.0.117",
2463
2442
  ]
@@ -3730,12 +3709,6 @@ version = "0.2.6"
3730
3709
  source = "registry+https://github.com/rust-lang/crates.io-index"
3731
3710
  checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853"
3732
3711
 
3733
- [[package]]
3734
- name = "unindent"
3735
- version = "0.2.4"
3736
- source = "registry+https://github.com/rust-lang/crates.io-index"
3737
- checksum = "7264e107f553ccae879d21fbea1d6724ac785e8c3bfc762137959b5802826ef3"
3738
-
3739
3712
  [[package]]
3740
3713
  name = "untrusted"
3741
3714
  version = "0.9.0"
@@ -7,10 +7,14 @@ edition = "2021"
7
7
  name = "_native"
8
8
  crate-type = ["cdylib"]
9
9
 
10
+ [features]
11
+ default = ["extension-module"]
12
+ extension-module = ["pyo3/extension-module"]
13
+
10
14
  [dependencies]
11
15
  chalk-remote-call-proto = { path = "../chalk-remote-call-proto" }
12
16
  redis = { version = "1.0.2", features = ["aio", "tokio-comp", "streams", "connection-manager"] }
13
- pyo3 = { version = "0.27", features = ["extension-module"] }
17
+ pyo3 = { version = "0.29" }
14
18
  tonic = { version = "0.12", features = ["tls", "tls-native-roots"] }
15
19
  tonic-health = "0.12"
16
20
  tonic-reflection = "0.12"
@@ -41,3 +45,7 @@ futures-util = "0.3"
41
45
  chalk-queue = { git = "https://github.com/chalk-ai/chalk-private.git", rev = "1460144ea659debbaee9dccadcd4d7dbf383ccf8" }
42
46
  chalk_metrics = { git = "https://github.com/chalk-ai/chalk-private.git", rev = "a0f8932ec10d3b8340af3e98cf63b800d60b4926" }
43
47
  chalk_statsd = { git = "https://github.com/chalk-ai/chalk-private.git", rev = "a0f8932ec10d3b8340af3e98cf63b800d60b4926" }
48
+
49
+ [target.'cfg(target_os = "linux")'.dev-dependencies]
50
+ async-trait = "0.1"
51
+ tokio = { version = "1", features = ["test-util"] }
@@ -14,7 +14,7 @@ use tonic::Status;
14
14
  use tracing::error;
15
15
 
16
16
  #[cfg(target_os = "linux")]
17
- use chalk_metrics::PublishingMetricsPipeline;
17
+ use crate::metrics::CallMetrics;
18
18
  use chalk_remote_call_proto::chalk::runtime::v1::CallFunctionResponse;
19
19
 
20
20
  use crate::python_bridge::{CallerInput, PythonHandler};
@@ -38,7 +38,7 @@ pub struct CoalescingQueue {
38
38
  max_duration: Duration,
39
39
  state: Mutex<QueueState>,
40
40
  #[cfg(target_os = "linux")]
41
- pipeline: Option<Arc<PublishingMetricsPipeline>>,
41
+ metrics: Option<Arc<CallMetrics>>,
42
42
  }
43
43
 
44
44
  impl CoalescingQueue {
@@ -46,7 +46,7 @@ impl CoalescingQueue {
46
46
  handler: Arc<PythonHandler>,
47
47
  max_size: usize,
48
48
  max_duration_ms: u64,
49
- #[cfg(target_os = "linux")] pipeline: Option<Arc<PublishingMetricsPipeline>>,
49
+ #[cfg(target_os = "linux")] metrics: Option<Arc<CallMetrics>>,
50
50
  ) -> Arc<Self> {
51
51
  Arc::new(Self {
52
52
  handler,
@@ -57,7 +57,7 @@ impl CoalescingQueue {
57
57
  flush_task: None,
58
58
  }),
59
59
  #[cfg(target_os = "linux")]
60
- pipeline,
60
+ metrics,
61
61
  })
62
62
  }
63
63
 
@@ -102,13 +102,13 @@ impl CoalescingQueue {
102
102
  // submissions while Python runs.
103
103
  let handler = Arc::clone(&self.handler);
104
104
  #[cfg(target_os = "linux")]
105
- let pipeline = self.pipeline.clone();
105
+ let metrics = self.metrics.clone();
106
106
  tokio::spawn(async move {
107
107
  Self::dispatch(
108
108
  handler,
109
109
  items,
110
110
  #[cfg(target_os = "linux")]
111
- pipeline,
111
+ metrics,
112
112
  )
113
113
  .await;
114
114
  });
@@ -117,7 +117,7 @@ impl CoalescingQueue {
117
117
  async fn dispatch(
118
118
  handler: Arc<PythonHandler>,
119
119
  items: Vec<BufferedCall>,
120
- #[cfg(target_os = "linux")] pipeline: Option<Arc<PublishingMetricsPipeline>>,
120
+ #[cfg(target_os = "linux")] metrics: Option<Arc<CallMetrics>>,
121
121
  ) {
122
122
  // Split each BufferedCall into its input (for the bridge) and its
123
123
  // response channel (for routing the reply back).
@@ -144,13 +144,13 @@ impl CoalescingQueue {
144
144
  );
145
145
  error!("{}", msg);
146
146
  #[cfg(target_os = "linux")]
147
- if let Some(p) = &pipeline {
147
+ if let Some(p) = &metrics {
148
148
  crate::metrics::record_completed_call(
149
149
  p,
150
150
  &function_name,
151
151
  /* success = */ false,
152
152
  started.elapsed(),
153
- chalk_metrics::metrics::tags::Mode::Sync,
153
+ crate::metrics::Mode::Sync,
154
154
  );
155
155
  }
156
156
  for tx in &response_txs {
@@ -159,13 +159,13 @@ impl CoalescingQueue {
159
159
  return;
160
160
  }
161
161
  #[cfg(target_os = "linux")]
162
- if let Some(p) = &pipeline {
162
+ if let Some(p) = &metrics {
163
163
  crate::metrics::record_completed_call(
164
164
  p,
165
165
  &function_name,
166
166
  /* success = */ true,
167
167
  started.elapsed(),
168
- chalk_metrics::metrics::tags::Mode::Sync,
168
+ crate::metrics::Mode::Sync,
169
169
  );
170
170
  }
171
171
  for (tx, chunk) in response_txs.into_iter().zip(per_caller_bytes) {
@@ -184,13 +184,13 @@ impl CoalescingQueue {
184
184
  // IPC decode errors are already caught by the service's
185
185
  // pre-validation; anything reaching here is a handler error.
186
186
  #[cfg(target_os = "linux")]
187
- if let Some(p) = &pipeline {
187
+ if let Some(p) = &metrics {
188
188
  crate::metrics::record_completed_call(
189
189
  p,
190
190
  &function_name,
191
191
  /* success = */ false,
192
192
  started.elapsed(),
193
- chalk_metrics::metrics::tags::Mode::Sync,
193
+ crate::metrics::Mode::Sync,
194
194
  );
195
195
  }
196
196
  let status = Status::unknown(e.to_string());
@@ -76,7 +76,7 @@ fn start_server(
76
76
  // chalk-queue / chalk_metrics, since these don't compile on macos
77
77
  // and windows. Built inside the runtime since it needs to `.await`.
78
78
  #[cfg(target_os = "linux")]
79
- let pipeline = crate::metrics::init_pipeline().await;
79
+ let metrics = crate::metrics::init().await;
80
80
 
81
81
  let coalescing_queue = if max_batching_size > 0 {
82
82
  Some(CoalescingQueue::new(
@@ -84,21 +84,29 @@ fn start_server(
84
84
  max_batching_size,
85
85
  max_buffer_duration_ms,
86
86
  #[cfg(target_os = "linux")]
87
- pipeline.clone(),
87
+ metrics.clone(),
88
88
  ))
89
89
  } else {
90
90
  None
91
91
  };
92
92
 
93
- server::run_server(
93
+ let server = server::run_server(
94
94
  host,
95
95
  port,
96
96
  python_handler,
97
97
  coalescing_queue,
98
98
  #[cfg(target_os = "linux")]
99
- pipeline,
100
- )
101
- .await
99
+ metrics.clone(),
100
+ );
101
+
102
+ #[cfg(target_os = "linux")]
103
+ {
104
+ crate::metrics::run_with_metrics(metrics, server).await
105
+ }
106
+ #[cfg(not(target_os = "linux"))]
107
+ {
108
+ server.await
109
+ }
102
110
  })
103
111
  .map_err(|e| pyo3::exceptions::PyRuntimeError::new_err(format!("Server error: {e}")))
104
112
  })