chalk-remote-call-python 1.9.0__tar.gz → 1.9.2__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.
- {chalk_remote_call_python-1.9.0 → chalk_remote_call_python-1.9.2}/PKG-INFO +31 -1
- {chalk_remote_call_python-1.9.0 → chalk_remote_call_python-1.9.2}/README.md +30 -0
- {chalk_remote_call_python-1.9.0 → chalk_remote_call_python-1.9.2}/chalk-remote-call-rs/Cargo.lock +8 -7
- {chalk_remote_call_python-1.9.0 → chalk_remote_call_python-1.9.2}/chalk-remote-call-rs/chalk-remote-call-server/Cargo.toml +5 -4
- {chalk_remote_call_python-1.9.0 → chalk_remote_call_python-1.9.2}/chalk-remote-call-rs/chalk-remote-call-server/src/async_service.rs +5 -5
- {chalk_remote_call_python-1.9.0 → chalk_remote_call_python-1.9.2}/chalk-remote-call-rs/chalk-remote-call-server/src/coalesce.rs +1 -2
- {chalk_remote_call_python-1.9.0 → chalk_remote_call_python-1.9.2}/chalk-remote-call-rs/chalk-remote-call-server/src/metrics.rs +16 -13
- {chalk_remote_call_python-1.9.0 → chalk_remote_call_python-1.9.2}/chalk-remote-call-rs/chalk-remote-call-server/src/python_bridge.rs +38 -3
- {chalk_remote_call_python-1.9.0 → chalk_remote_call_python-1.9.2}/chalk-remote-call-rs/chalk-remote-call-server/src/self_consumer.rs +264 -83
- {chalk_remote_call_python-1.9.0 → chalk_remote_call_python-1.9.2}/chalk-remote-call-rs/chalk-remote-call-server/src/server.rs +1 -2
- {chalk_remote_call_python-1.9.0 → chalk_remote_call_python-1.9.2}/chalk-remote-call-rs/chalk-remote-call-server/src/service.rs +1 -5
- chalk_remote_call_python-1.9.2/chalk_remote_call/_version.py +1 -0
- {chalk_remote_call_python-1.9.0 → chalk_remote_call_python-1.9.2}/chalk_remote_call/cli.py +10 -10
- chalk_remote_call_python-1.9.2/chalk_remote_call/errors.py +102 -0
- chalk_remote_call_python-1.9.2/chalk_remote_call/logging.py +29 -0
- {chalk_remote_call_python-1.9.0 → chalk_remote_call_python-1.9.2}/chalk_remote_call/servicer.py +26 -38
- {chalk_remote_call_python-1.9.0 → chalk_remote_call_python-1.9.2}/chalk_remote_call/tracing.py +34 -7
- {chalk_remote_call_python-1.9.0 → chalk_remote_call_python-1.9.2}/chalk_remote_call_python.egg-info/PKG-INFO +31 -1
- {chalk_remote_call_python-1.9.0 → chalk_remote_call_python-1.9.2}/chalk_remote_call_python.egg-info/SOURCES.txt +2 -0
- chalk_remote_call_python-1.9.0/chalk_remote_call/_version.py +0 -1
- {chalk_remote_call_python-1.9.0 → chalk_remote_call_python-1.9.2}/MANIFEST.in +0 -0
- {chalk_remote_call_python-1.9.0 → chalk_remote_call_python-1.9.2}/chalk-remote-call-rs/Cargo.toml +0 -0
- {chalk_remote_call_python-1.9.0 → chalk_remote_call_python-1.9.2}/chalk-remote-call-rs/chalk-remote-call-proto/Cargo.toml +0 -0
- {chalk_remote_call_python-1.9.0 → chalk_remote_call_python-1.9.2}/chalk-remote-call-rs/chalk-remote-call-proto/src/gen/chalk.auth.v1.rs +0 -0
- {chalk_remote_call_python-1.9.0 → chalk_remote_call_python-1.9.2}/chalk-remote-call-rs/chalk-remote-call-proto/src/gen/chalk.common.v1.rs +0 -0
- {chalk_remote_call_python-1.9.0 → chalk_remote_call_python-1.9.2}/chalk-remote-call-rs/chalk-remote-call-proto/src/gen/chalk.runtime.v1.rs +0 -0
- {chalk_remote_call_python-1.9.0 → chalk_remote_call_python-1.9.2}/chalk-remote-call-rs/chalk-remote-call-proto/src/gen/chalk.runtime.v1.tonic.rs +0 -0
- {chalk_remote_call_python-1.9.0 → chalk_remote_call_python-1.9.2}/chalk-remote-call-rs/chalk-remote-call-proto/src/gen/chalk.utils.v1.rs +0 -0
- {chalk_remote_call_python-1.9.0 → chalk_remote_call_python-1.9.2}/chalk-remote-call-rs/chalk-remote-call-proto/src/gen/descriptor.bin +0 -0
- {chalk_remote_call_python-1.9.0 → chalk_remote_call_python-1.9.2}/chalk-remote-call-rs/chalk-remote-call-proto/src/lib.rs +0 -0
- {chalk_remote_call_python-1.9.0 → chalk_remote_call_python-1.9.2}/chalk-remote-call-rs/chalk-remote-call-server/src/lib.rs +0 -0
- {chalk_remote_call_python-1.9.0 → chalk_remote_call_python-1.9.2}/chalk-remote-call-rs/rust-toolchain.toml +0 -0
- {chalk_remote_call_python-1.9.0 → chalk_remote_call_python-1.9.2}/chalk_remote_call/__init__.py +0 -0
- {chalk_remote_call_python-1.9.0 → chalk_remote_call_python-1.9.2}/chalk_remote_call/__main__.py +0 -0
- {chalk_remote_call_python-1.9.0 → chalk_remote_call_python-1.9.2}/chalk_remote_call/_gen/__init__.py +0 -0
- {chalk_remote_call_python-1.9.0 → chalk_remote_call_python-1.9.2}/chalk_remote_call/_gen/chalk/__init__.py +0 -0
- {chalk_remote_call_python-1.9.0 → chalk_remote_call_python-1.9.2}/chalk_remote_call/_gen/chalk/auth/__init__.py +0 -0
- {chalk_remote_call_python-1.9.0 → chalk_remote_call_python-1.9.2}/chalk_remote_call/_gen/chalk/auth/v1/__init__.py +0 -0
- {chalk_remote_call_python-1.9.0 → chalk_remote_call_python-1.9.2}/chalk_remote_call/_gen/chalk/auth/v1/permissions_pb2.py +0 -0
- {chalk_remote_call_python-1.9.0 → chalk_remote_call_python-1.9.2}/chalk_remote_call/_gen/chalk/auth/v1/permissions_pb2_grpc.py +0 -0
- {chalk_remote_call_python-1.9.0 → chalk_remote_call_python-1.9.2}/chalk_remote_call/_gen/chalk/common/__init__.py +0 -0
- {chalk_remote_call_python-1.9.0 → chalk_remote_call_python-1.9.2}/chalk_remote_call/_gen/chalk/common/v1/__init__.py +0 -0
- {chalk_remote_call_python-1.9.0 → chalk_remote_call_python-1.9.2}/chalk_remote_call/_gen/chalk/common/v1/chalk_error_pb2.py +0 -0
- {chalk_remote_call_python-1.9.0 → chalk_remote_call_python-1.9.2}/chalk_remote_call/_gen/chalk/common/v1/chalk_error_pb2_grpc.py +0 -0
- {chalk_remote_call_python-1.9.0 → chalk_remote_call_python-1.9.2}/chalk_remote_call/_gen/chalk/runtime/__init__.py +0 -0
- {chalk_remote_call_python-1.9.0 → chalk_remote_call_python-1.9.2}/chalk_remote_call/_gen/chalk/runtime/v1/__init__.py +0 -0
- {chalk_remote_call_python-1.9.0 → chalk_remote_call_python-1.9.2}/chalk_remote_call/_gen/chalk/runtime/v1/remote_python_call_pb2.py +0 -0
- {chalk_remote_call_python-1.9.0 → chalk_remote_call_python-1.9.2}/chalk_remote_call/_gen/chalk/runtime/v1/remote_python_call_pb2_grpc.py +0 -0
- {chalk_remote_call_python-1.9.0 → chalk_remote_call_python-1.9.2}/chalk_remote_call/_gen/chalk/utils/__init__.py +0 -0
- {chalk_remote_call_python-1.9.0 → chalk_remote_call_python-1.9.2}/chalk_remote_call/_gen/chalk/utils/v1/__init__.py +0 -0
- {chalk_remote_call_python-1.9.0 → chalk_remote_call_python-1.9.2}/chalk_remote_call/_gen/chalk/utils/v1/encoding_pb2.py +0 -0
- {chalk_remote_call_python-1.9.0 → chalk_remote_call_python-1.9.2}/chalk_remote_call/_gen/chalk/utils/v1/encoding_pb2_grpc.py +0 -0
- {chalk_remote_call_python-1.9.0 → chalk_remote_call_python-1.9.2}/chalk_remote_call/_gen/chalk/utils/v1/field_change_pb2.py +0 -0
- {chalk_remote_call_python-1.9.0 → chalk_remote_call_python-1.9.2}/chalk_remote_call/_gen/chalk/utils/v1/field_change_pb2_grpc.py +0 -0
- {chalk_remote_call_python-1.9.0 → chalk_remote_call_python-1.9.2}/chalk_remote_call/_gen/chalk/utils/v1/sensitive_pb2.py +0 -0
- {chalk_remote_call_python-1.9.0 → chalk_remote_call_python-1.9.2}/chalk_remote_call/_gen/chalk/utils/v1/sensitive_pb2_grpc.py +0 -0
- {chalk_remote_call_python-1.9.0 → chalk_remote_call_python-1.9.2}/chalk_remote_call/_native.pyi +0 -0
- {chalk_remote_call_python-1.9.0 → chalk_remote_call_python-1.9.2}/chalk_remote_call/arrow_utils.py +0 -0
- {chalk_remote_call_python-1.9.0 → chalk_remote_call_python-1.9.2}/chalk_remote_call/handler_loader.py +0 -0
- {chalk_remote_call_python-1.9.0 → chalk_remote_call_python-1.9.2}/chalk_remote_call/input_transform.py +0 -0
- {chalk_remote_call_python-1.9.0 → chalk_remote_call_python-1.9.2}/chalk_remote_call/server.py +0 -0
- {chalk_remote_call_python-1.9.0 → chalk_remote_call_python-1.9.2}/chalk_remote_call_python.egg-info/dependency_links.txt +0 -0
- {chalk_remote_call_python-1.9.0 → chalk_remote_call_python-1.9.2}/chalk_remote_call_python.egg-info/entry_points.txt +0 -0
- {chalk_remote_call_python-1.9.0 → chalk_remote_call_python-1.9.2}/chalk_remote_call_python.egg-info/requires.txt +0 -0
- {chalk_remote_call_python-1.9.0 → chalk_remote_call_python-1.9.2}/chalk_remote_call_python.egg-info/top_level.txt +0 -0
- {chalk_remote_call_python-1.9.0 → chalk_remote_call_python-1.9.2}/pyproject.toml +0 -0
- {chalk_remote_call_python-1.9.0 → chalk_remote_call_python-1.9.2}/setup.cfg +0 -0
- {chalk_remote_call_python-1.9.0 → chalk_remote_call_python-1.9.2}/setup.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: chalk-remote-call-python
|
|
3
|
-
Version: 1.9.
|
|
3
|
+
Version: 1.9.2
|
|
4
4
|
Summary: Chalk remote call Python runtime interface client
|
|
5
5
|
Author: Chalk AI, Inc.
|
|
6
6
|
Project-URL: Homepage, https://chalk.ai
|
|
@@ -108,6 +108,16 @@ python -m chalk_remote_call --handler my_handler.handler
|
|
|
108
108
|
| `--on-shutdown` | | | Dotted path to a shutdown function |
|
|
109
109
|
| `--log-level` | | `INFO` | `DEBUG`, `INFO`, `WARNING`, or `ERROR` |
|
|
110
110
|
|
|
111
|
+
The CLI writes Python logs to stderr as one JSON object per line, with separate
|
|
112
|
+
`timestamp`, `severity`, `logger`, and `message` fields. Exceptions include an
|
|
113
|
+
`exception.stacktrace` field. Calls to `serve()` from Python retain the embedding
|
|
114
|
+
application's logging configuration.
|
|
115
|
+
|
|
116
|
+
Missing optional StatsD endpoints or a metrics-bus topic do not emit warnings.
|
|
117
|
+
Failures initializing configured metrics sinks still warn. Routine customer
|
|
118
|
+
StatsD configuration messages are emitted at DEBUG by the shared metrics library;
|
|
119
|
+
set `RUST_LOG=info,chalk_metrics::metrics::config=debug` to include them.
|
|
120
|
+
|
|
111
121
|
### Environment variables
|
|
112
122
|
|
|
113
123
|
| Variable | Description |
|
|
@@ -212,3 +222,23 @@ To check the Rust code independently:
|
|
|
212
222
|
```bash
|
|
213
223
|
PYO3_PYTHON=python3 cargo check --manifest-path chalk-remote-call-rs/chalk-remote-call-server/Cargo.toml
|
|
214
224
|
```
|
|
225
|
+
|
|
226
|
+
## Remote exception transport
|
|
227
|
+
|
|
228
|
+
Handler failures retain their original exception type, message, traceback,
|
|
229
|
+
exception chains, and exception groups. Runtime dispatch frames are excluded
|
|
230
|
+
from the user traceback; full diagnostics are retained in server logs.
|
|
231
|
+
|
|
232
|
+
All call modes carry a JSON payload with `chalk_remote_error: 1` and an
|
|
233
|
+
`exception` object containing the `ChalkException` fields `kind`, `message`,
|
|
234
|
+
`stacktrace`, and `internal_stacktrace`. Direct calls carry the payload as the
|
|
235
|
+
unescaped gRPC status message; queued calls carry it in the error message. The
|
|
236
|
+
local async service additionally populates `ChalkError.exception`. This permits
|
|
237
|
+
existing queue transports to forward structured errors without a protobuf
|
|
238
|
+
migration. Clients must decode the versioned payload, not parse gRPC debug text
|
|
239
|
+
or classify user errors by their message. Unknown versions remain opaque.
|
|
240
|
+
|
|
241
|
+
Payloads are bounded for gRPC header limits. Truncation is marked explicitly,
|
|
242
|
+
with complete tracebacks kept in server logs. Exception objects and locals are
|
|
243
|
+
never pickled or sent. Chalk SDK-generated handlers identify their dispatch
|
|
244
|
+
frames, and notebook source maps identify the deployed snapshot's lines.
|
|
@@ -70,6 +70,16 @@ python -m chalk_remote_call --handler my_handler.handler
|
|
|
70
70
|
| `--on-shutdown` | | | Dotted path to a shutdown function |
|
|
71
71
|
| `--log-level` | | `INFO` | `DEBUG`, `INFO`, `WARNING`, or `ERROR` |
|
|
72
72
|
|
|
73
|
+
The CLI writes Python logs to stderr as one JSON object per line, with separate
|
|
74
|
+
`timestamp`, `severity`, `logger`, and `message` fields. Exceptions include an
|
|
75
|
+
`exception.stacktrace` field. Calls to `serve()` from Python retain the embedding
|
|
76
|
+
application's logging configuration.
|
|
77
|
+
|
|
78
|
+
Missing optional StatsD endpoints or a metrics-bus topic do not emit warnings.
|
|
79
|
+
Failures initializing configured metrics sinks still warn. Routine customer
|
|
80
|
+
StatsD configuration messages are emitted at DEBUG by the shared metrics library;
|
|
81
|
+
set `RUST_LOG=info,chalk_metrics::metrics::config=debug` to include them.
|
|
82
|
+
|
|
73
83
|
### Environment variables
|
|
74
84
|
|
|
75
85
|
| Variable | Description |
|
|
@@ -174,3 +184,23 @@ To check the Rust code independently:
|
|
|
174
184
|
```bash
|
|
175
185
|
PYO3_PYTHON=python3 cargo check --manifest-path chalk-remote-call-rs/chalk-remote-call-server/Cargo.toml
|
|
176
186
|
```
|
|
187
|
+
|
|
188
|
+
## Remote exception transport
|
|
189
|
+
|
|
190
|
+
Handler failures retain their original exception type, message, traceback,
|
|
191
|
+
exception chains, and exception groups. Runtime dispatch frames are excluded
|
|
192
|
+
from the user traceback; full diagnostics are retained in server logs.
|
|
193
|
+
|
|
194
|
+
All call modes carry a JSON payload with `chalk_remote_error: 1` and an
|
|
195
|
+
`exception` object containing the `ChalkException` fields `kind`, `message`,
|
|
196
|
+
`stacktrace`, and `internal_stacktrace`. Direct calls carry the payload as the
|
|
197
|
+
unescaped gRPC status message; queued calls carry it in the error message. The
|
|
198
|
+
local async service additionally populates `ChalkError.exception`. This permits
|
|
199
|
+
existing queue transports to forward structured errors without a protobuf
|
|
200
|
+
migration. Clients must decode the versioned payload, not parse gRPC debug text
|
|
201
|
+
or classify user errors by their message. Unknown versions remain opaque.
|
|
202
|
+
|
|
203
|
+
Payloads are bounded for gRPC header limits. Truncation is marked explicitly,
|
|
204
|
+
with complete tracebacks kept in server logs. Exception objects and locals are
|
|
205
|
+
never pickled or sent. Chalk SDK-generated handlers identify their dispatch
|
|
206
|
+
frames, and notebook source maps identify the deployed snapshot's lines.
|
{chalk_remote_call_python-1.9.0 → chalk_remote_call_python-1.9.2}/chalk-remote-call-rs/Cargo.lock
RENAMED
|
@@ -484,7 +484,7 @@ dependencies = [
|
|
|
484
484
|
[[package]]
|
|
485
485
|
name = "chalk-core"
|
|
486
486
|
version = "0.0.0"
|
|
487
|
-
source = "git+https://github.com/chalk-ai/chalk-private.git?rev=
|
|
487
|
+
source = "git+https://github.com/chalk-ai/chalk-private.git?rev=a0f8932ec10d3b8340af3e98cf63b800d60b4926#a0f8932ec10d3b8340af3e98cf63b800d60b4926"
|
|
488
488
|
dependencies = [
|
|
489
489
|
"anyhow",
|
|
490
490
|
"envconfig",
|
|
@@ -499,7 +499,7 @@ dependencies = [
|
|
|
499
499
|
[[package]]
|
|
500
500
|
name = "chalk-protos"
|
|
501
501
|
version = "0.0.0"
|
|
502
|
-
source = "git+https://github.com/chalk-ai/chalk-private.git?rev=
|
|
502
|
+
source = "git+https://github.com/chalk-ai/chalk-private.git?rev=a0f8932ec10d3b8340af3e98cf63b800d60b4926#a0f8932ec10d3b8340af3e98cf63b800d60b4926"
|
|
503
503
|
dependencies = [
|
|
504
504
|
"prost 0.11.9",
|
|
505
505
|
"prost-build",
|
|
@@ -511,7 +511,7 @@ dependencies = [
|
|
|
511
511
|
[[package]]
|
|
512
512
|
name = "chalk-queue"
|
|
513
513
|
version = "0.0.0"
|
|
514
|
-
source = "git+https://github.com/chalk-ai/chalk-private.git?rev=
|
|
514
|
+
source = "git+https://github.com/chalk-ai/chalk-private.git?rev=9c61f6a938d8f885f138217ac64149e29d7a691e#9c61f6a938d8f885f138217ac64149e29d7a691e"
|
|
515
515
|
dependencies = [
|
|
516
516
|
"base64 0.22.1",
|
|
517
517
|
"redis",
|
|
@@ -547,6 +547,7 @@ dependencies = [
|
|
|
547
547
|
"prost 0.13.5",
|
|
548
548
|
"pyo3",
|
|
549
549
|
"redis",
|
|
550
|
+
"serde_json",
|
|
550
551
|
"tokio",
|
|
551
552
|
"tokio-stream",
|
|
552
553
|
"tonic 0.12.3",
|
|
@@ -560,7 +561,7 @@ dependencies = [
|
|
|
560
561
|
[[package]]
|
|
561
562
|
name = "chalk_metric_definitions"
|
|
562
563
|
version = "0.0.0"
|
|
563
|
-
source = "git+https://github.com/chalk-ai/chalk-private.git?rev=
|
|
564
|
+
source = "git+https://github.com/chalk-ai/chalk-private.git?rev=a0f8932ec10d3b8340af3e98cf63b800d60b4926#a0f8932ec10d3b8340af3e98cf63b800d60b4926"
|
|
564
565
|
dependencies = [
|
|
565
566
|
"chalk-protos",
|
|
566
567
|
"metrics-generator",
|
|
@@ -570,7 +571,7 @@ dependencies = [
|
|
|
570
571
|
[[package]]
|
|
571
572
|
name = "chalk_metrics"
|
|
572
573
|
version = "0.0.0"
|
|
573
|
-
source = "git+https://github.com/chalk-ai/chalk-private.git?rev=
|
|
574
|
+
source = "git+https://github.com/chalk-ai/chalk-private.git?rev=a0f8932ec10d3b8340af3e98cf63b800d60b4926#a0f8932ec10d3b8340af3e98cf63b800d60b4926"
|
|
574
575
|
dependencies = [
|
|
575
576
|
"async-trait",
|
|
576
577
|
"chalk-core",
|
|
@@ -604,7 +605,7 @@ dependencies = [
|
|
|
604
605
|
[[package]]
|
|
605
606
|
name = "chalk_statsd"
|
|
606
607
|
version = "0.0.0"
|
|
607
|
-
source = "git+https://github.com/chalk-ai/chalk-private.git?rev=
|
|
608
|
+
source = "git+https://github.com/chalk-ai/chalk-private.git?rev=a0f8932ec10d3b8340af3e98cf63b800d60b4926#a0f8932ec10d3b8340af3e98cf63b800d60b4926"
|
|
608
609
|
dependencies = [
|
|
609
610
|
"chalk-core",
|
|
610
611
|
"chrono",
|
|
@@ -1867,7 +1868,7 @@ dependencies = [
|
|
|
1867
1868
|
[[package]]
|
|
1868
1869
|
name = "metrics-generator"
|
|
1869
1870
|
version = "0.1.0"
|
|
1870
|
-
source = "git+https://github.com/chalk-ai/chalk-private.git?rev=
|
|
1871
|
+
source = "git+https://github.com/chalk-ai/chalk-private.git?rev=a0f8932ec10d3b8340af3e98cf63b800d60b4926#a0f8932ec10d3b8340af3e98cf63b800d60b4926"
|
|
1871
1872
|
dependencies = [
|
|
1872
1873
|
"codegen",
|
|
1873
1874
|
"serde",
|
|
@@ -21,6 +21,7 @@ arrow = { version = "54", default-features = false, features = ["ipc"] }
|
|
|
21
21
|
tracing = "0.1"
|
|
22
22
|
tracing-subscriber = { version = "0.3", features = ["env-filter", "json"] }
|
|
23
23
|
bytes = "1"
|
|
24
|
+
serde_json = "1"
|
|
24
25
|
uuid = { version = "1", features = ["v4"] }
|
|
25
26
|
dashmap = "5"
|
|
26
27
|
futures-util = "0.3"
|
|
@@ -34,8 +35,8 @@ futures-util = "0.3"
|
|
|
34
35
|
# chalk-private commit, mirroring how chalkcompute_remote_client depends on
|
|
35
36
|
# chalk_remote_call_client. chalk-queue declares `redis = "1.0.2"`; with no
|
|
36
37
|
# `[patch.crates-io]` here it builds against vanilla crates.io redis (it only
|
|
37
|
-
# uses standard APIs).
|
|
38
|
+
# uses standard APIs). Metrics and StatsD share a revision so their client types agree.
|
|
38
39
|
[target.'cfg(target_os = "linux")'.dependencies]
|
|
39
|
-
chalk-queue = { git = "https://github.com/chalk-ai/chalk-private.git", rev = "
|
|
40
|
-
chalk_metrics = { git = "https://github.com/chalk-ai/chalk-private.git", rev = "
|
|
41
|
-
chalk_statsd = { git = "https://github.com/chalk-ai/chalk-private.git", rev = "
|
|
40
|
+
chalk-queue = { git = "https://github.com/chalk-ai/chalk-private.git", rev = "9c61f6a938d8f885f138217ac64149e29d7a691e" }
|
|
41
|
+
chalk_metrics = { git = "https://github.com/chalk-ai/chalk-private.git", rev = "a0f8932ec10d3b8340af3e98cf63b800d60b4926" }
|
|
42
|
+
chalk_statsd = { git = "https://github.com/chalk-ai/chalk-private.git", rev = "a0f8932ec10d3b8340af3e98cf63b800d60b4926" }
|
|
@@ -39,7 +39,7 @@ struct CallState {
|
|
|
39
39
|
/// and `status`/`error` can be updated without blocking emits.
|
|
40
40
|
chunks: Arc<Mutex<ChunkBuffer>>,
|
|
41
41
|
/// Populated only when `status == Failed`; surfaced as a `ChalkError`.
|
|
42
|
-
error: Option<
|
|
42
|
+
error: Option<ChalkError>,
|
|
43
43
|
/// When the call reached a terminal status. Used only by the orphan sweeper
|
|
44
44
|
/// to decide when an un-drained terminal entry is safe to reclaim.
|
|
45
45
|
completed_at: Option<Instant>,
|
|
@@ -189,7 +189,7 @@ impl AsyncRemoteCallService for AsyncRemoteCallServiceImpl {
|
|
|
189
189
|
}
|
|
190
190
|
Err(e) => {
|
|
191
191
|
s.status = RemoteCallStatus::Failed;
|
|
192
|
-
s.error = Some(e.
|
|
192
|
+
s.error = Some(e.chalk_error());
|
|
193
193
|
error!(
|
|
194
194
|
call_id = %id,
|
|
195
195
|
exception.stacktrace = e.details(),
|
|
@@ -246,10 +246,10 @@ impl AsyncRemoteCallService for AsyncRemoteCallServiceImpl {
|
|
|
246
246
|
drop(buf);
|
|
247
247
|
|
|
248
248
|
let errors = if status == RemoteCallStatus::Failed {
|
|
249
|
-
vec![ChalkError {
|
|
250
|
-
message:
|
|
249
|
+
vec![error.unwrap_or_else(|| ChalkError {
|
|
250
|
+
message: "remote call failed".to_string(),
|
|
251
251
|
..Default::default()
|
|
252
|
-
}]
|
|
252
|
+
})]
|
|
253
253
|
} else {
|
|
254
254
|
Vec::new()
|
|
255
255
|
};
|
|
@@ -193,8 +193,7 @@ impl CoalescingQueue {
|
|
|
193
193
|
chalk_metrics::metrics::tags::Mode::Sync,
|
|
194
194
|
);
|
|
195
195
|
}
|
|
196
|
-
let status =
|
|
197
|
-
Status::unknown(format!("Exception raised during handler execution: {e}"));
|
|
196
|
+
let status = Status::unknown(e.to_string());
|
|
198
197
|
for tx in response_txs {
|
|
199
198
|
let _ = tx.send(Err(status.clone())).await;
|
|
200
199
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
//!
|
|
2
|
-
//!
|
|
3
|
-
//!
|
|
1
|
+
//! Function-call metrics for synchronous gRPC calls and self-consumed queue work.
|
|
2
|
+
//! A shared `chalk_metrics` publishing pipeline emits call counts and
|
|
3
|
+
//! processing latency, independently of whether Redis queue consumption is enabled.
|
|
4
4
|
//!
|
|
5
5
|
//! The External Function "Function Calls Dequeued" chart reads TimescaleDB
|
|
6
6
|
//! `metrics1`, which is fed only by the chalk_metrics PubSub bus (statsd goes to
|
|
@@ -15,8 +15,9 @@ use chalk_metrics::metrics::well_known_metrics::WellKnownMetricName;
|
|
|
15
15
|
use chalk_metrics::{
|
|
16
16
|
make_pubsub_publisher, BatchConfig, BusPublisher, MetricsPipeline, PublishingMetricsPipeline,
|
|
17
17
|
};
|
|
18
|
+
use chalk_statsd::datadog::DatadogError;
|
|
18
19
|
use chalk_statsd::metrics::MetricsClient;
|
|
19
|
-
use tracing::{
|
|
20
|
+
use tracing::{debug, warn};
|
|
20
21
|
|
|
21
22
|
// Batch tuning — chalk_function_queue's defaults (METRICS_BATCH_* ), inlined.
|
|
22
23
|
const BATCH_MAX_MESSAGES: usize = 1000;
|
|
@@ -24,26 +25,27 @@ const BATCH_MAX_BYTES: usize = 10 * 1024 * 1024; // 10 MB
|
|
|
24
25
|
const BATCH_MAX_LATENCY: Duration = Duration::from_millis(100);
|
|
25
26
|
|
|
26
27
|
/// Build and start the metrics pipeline from the environment, mirroring the
|
|
27
|
-
/// fnq-server / catalog-consumer init. Returns `None`
|
|
28
|
-
/// object can't be constructed; the self-consumer then runs without metrics.
|
|
28
|
+
/// fnq-server / catalog-consumer init. Returns `None` if startup fails.
|
|
29
29
|
///
|
|
30
30
|
/// The bus publisher is what reaches the metrics store (and thus the dashboard);
|
|
31
|
-
///
|
|
32
|
-
///
|
|
31
|
+
/// StatsD and the bus are optional sinks. Missing configuration is quiet;
|
|
32
|
+
/// failures initializing a configured sink remain warnings.
|
|
33
33
|
pub async fn init_pipeline() -> Option<Arc<PublishingMetricsPipeline>> {
|
|
34
34
|
let environment_id = std::env::var("CHALK_ENVIRONMENT_ID").unwrap_or_default();
|
|
35
35
|
|
|
36
36
|
let statsd = Arc::new(
|
|
37
37
|
MetricsClient::new_from_default_environment().unwrap_or_else(|e| {
|
|
38
|
-
|
|
38
|
+
if !matches!(
|
|
39
|
+
e.downcast_ref::<DatadogError>(),
|
|
40
|
+
Some(DatadogError::ConnectionInfoNotFound)
|
|
41
|
+
) {
|
|
42
|
+
warn!(error = %e, "failed to init statsd client; statsd metrics disabled");
|
|
43
|
+
}
|
|
39
44
|
MetricsClient::new_null()
|
|
40
45
|
}),
|
|
41
46
|
);
|
|
42
47
|
|
|
43
48
|
let publishers: Vec<Arc<dyn BusPublisher>> = build_bus_publisher().await.into_iter().collect();
|
|
44
|
-
if publishers.is_empty() {
|
|
45
|
-
warn!("no metrics bus publisher configured; function call metrics will not reach the dashboard");
|
|
46
|
-
}
|
|
47
49
|
|
|
48
50
|
let metrics_pipeline: Arc<PublishingMetricsPipeline> =
|
|
49
51
|
Arc::new(PublishingMetricsPipeline::new_with_env_var_defaults(
|
|
@@ -54,8 +56,9 @@ pub async fn init_pipeline() -> Option<Arc<PublishingMetricsPipeline>> {
|
|
|
54
56
|
));
|
|
55
57
|
if let Err(e) = metrics_pipeline.start().await {
|
|
56
58
|
warn!(error = %e, "failed to start metrics pipeline; metrics disabled");
|
|
59
|
+
return None;
|
|
57
60
|
}
|
|
58
|
-
|
|
61
|
+
debug!("function-call metrics pipeline started");
|
|
59
62
|
Some(metrics_pipeline)
|
|
60
63
|
}
|
|
61
64
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
use std::collections::HashMap;
|
|
2
2
|
use std::sync::{Arc, Mutex};
|
|
3
3
|
|
|
4
|
+
use chalk_remote_call_proto::chalk::common::v1::{ChalkError, ChalkException};
|
|
4
5
|
use chalk_remote_call_proto::chalk::runtime::v1::CallFunctionResponse;
|
|
5
6
|
use pyo3::prelude::*;
|
|
6
7
|
use pyo3::types::{PyBytes, PyDict, PyList};
|
|
@@ -321,28 +322,62 @@ fn invoke_process_fn(
|
|
|
321
322
|
#[derive(Debug)]
|
|
322
323
|
pub struct PythonError {
|
|
323
324
|
details: String,
|
|
325
|
+
wire_message: String,
|
|
324
326
|
}
|
|
325
327
|
|
|
326
328
|
impl PythonError {
|
|
327
329
|
fn new(message: String) -> Self {
|
|
328
|
-
Self {
|
|
330
|
+
Self {
|
|
331
|
+
details: message.clone(),
|
|
332
|
+
wire_message: message,
|
|
333
|
+
}
|
|
329
334
|
}
|
|
330
335
|
|
|
331
336
|
pub fn details(&self) -> &str {
|
|
332
337
|
&self.details
|
|
333
338
|
}
|
|
339
|
+
|
|
340
|
+
pub fn chalk_error(&self) -> ChalkError {
|
|
341
|
+
let exception = serde_json::from_str::<serde_json::Value>(&self.wire_message)
|
|
342
|
+
.ok()
|
|
343
|
+
.and_then(|payload| {
|
|
344
|
+
let exception = payload.get("exception")?;
|
|
345
|
+
Some(ChalkException {
|
|
346
|
+
kind: exception.get("kind")?.as_str()?.to_string(),
|
|
347
|
+
message: exception.get("message")?.as_str()?.to_string(),
|
|
348
|
+
stacktrace: exception.get("stacktrace")?.as_str()?.to_string(),
|
|
349
|
+
internal_stacktrace: exception
|
|
350
|
+
.get("internal_stacktrace")?
|
|
351
|
+
.as_str()?
|
|
352
|
+
.to_string(),
|
|
353
|
+
})
|
|
354
|
+
});
|
|
355
|
+
ChalkError {
|
|
356
|
+
message: self.wire_message.clone(),
|
|
357
|
+
exception,
|
|
358
|
+
..Default::default()
|
|
359
|
+
}
|
|
360
|
+
}
|
|
334
361
|
}
|
|
335
362
|
|
|
336
363
|
impl std::fmt::Display for PythonError {
|
|
337
364
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
|
338
|
-
write!(f, "{}", self.
|
|
365
|
+
write!(f, "{}", self.wire_message)
|
|
339
366
|
}
|
|
340
367
|
}
|
|
341
368
|
|
|
342
369
|
fn into_python_error(py: Python<'_>, err: PyErr) -> PythonError {
|
|
343
370
|
let summary = err.to_string();
|
|
344
371
|
let details = format_python_traceback(py, &err).unwrap_or_else(|_| summary.clone());
|
|
345
|
-
|
|
372
|
+
let wire_message = py
|
|
373
|
+
.import("chalk_remote_call.errors")
|
|
374
|
+
.and_then(|module| module.call_method1("serialize_exception", (err.value(py),)))
|
|
375
|
+
.and_then(|value| value.extract::<String>())
|
|
376
|
+
.unwrap_or_else(|_| details.clone());
|
|
377
|
+
PythonError {
|
|
378
|
+
details,
|
|
379
|
+
wire_message,
|
|
380
|
+
}
|
|
346
381
|
}
|
|
347
382
|
|
|
348
383
|
fn format_python_traceback(py: Python<'_>, err: &PyErr) -> PyResult<String> {
|