@temporalio/core-bridge 1.12.0 → 1.12.2
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.
- package/Cargo.lock +64 -119
- package/Cargo.toml +1 -1
- package/index.js +3 -2
- package/package.json +3 -3
- package/releases/aarch64-apple-darwin/index.node +0 -0
- package/releases/aarch64-unknown-linux-gnu/index.node +0 -0
- package/releases/x86_64-apple-darwin/index.node +0 -0
- package/releases/x86_64-pc-windows-msvc/index.node +0 -0
- package/releases/x86_64-unknown-linux-gnu/index.node +0 -0
- package/sdk-core/.cargo/config.toml +1 -2
- package/sdk-core/.github/workflows/per-pr.yml +2 -0
- package/sdk-core/AGENTS.md +7 -0
- package/sdk-core/Cargo.toml +9 -5
- package/sdk-core/README.md +6 -5
- package/sdk-core/client/Cargo.toml +3 -2
- package/sdk-core/client/src/lib.rs +17 -8
- package/sdk-core/client/src/metrics.rs +57 -23
- package/sdk-core/client/src/raw.rs +33 -15
- package/sdk-core/core/Cargo.toml +11 -9
- package/sdk-core/core/benches/workflow_replay.rs +114 -15
- package/sdk-core/core/src/core_tests/activity_tasks.rs +18 -18
- package/sdk-core/core/src/core_tests/child_workflows.rs +4 -4
- package/sdk-core/core/src/core_tests/determinism.rs +6 -6
- package/sdk-core/core/src/core_tests/local_activities.rs +20 -20
- package/sdk-core/core/src/core_tests/mod.rs +40 -5
- package/sdk-core/core/src/core_tests/queries.rs +25 -16
- package/sdk-core/core/src/core_tests/replay_flag.rs +3 -3
- package/sdk-core/core/src/core_tests/updates.rs +3 -3
- package/sdk-core/core/src/core_tests/workers.rs +9 -7
- package/sdk-core/core/src/core_tests/workflow_tasks.rs +40 -42
- package/sdk-core/core/src/ephemeral_server/mod.rs +1 -19
- package/sdk-core/core/src/lib.rs +10 -1
- package/sdk-core/core/src/pollers/poll_buffer.rs +2 -2
- package/sdk-core/core/src/replay/mod.rs +3 -3
- package/sdk-core/core/src/telemetry/metrics.rs +306 -152
- package/sdk-core/core/src/telemetry/mod.rs +11 -4
- package/sdk-core/core/src/telemetry/otel.rs +134 -131
- package/sdk-core/core/src/telemetry/prometheus_meter.rs +885 -0
- package/sdk-core/core/src/telemetry/prometheus_server.rs +48 -28
- package/sdk-core/core/src/test_help/mod.rs +27 -12
- package/sdk-core/core/src/worker/activities/activity_heartbeat_manager.rs +7 -7
- package/sdk-core/core/src/worker/activities.rs +4 -4
- package/sdk-core/core/src/worker/client/mocks.rs +10 -3
- package/sdk-core/core/src/worker/client.rs +68 -5
- package/sdk-core/core/src/worker/heartbeat.rs +229 -0
- package/sdk-core/core/src/worker/mod.rs +35 -14
- package/sdk-core/core/src/worker/tuner/resource_based.rs +4 -4
- package/sdk-core/core/src/worker/workflow/history_update.rs +71 -19
- package/sdk-core/core/src/worker/workflow/machines/cancel_external_state_machine.rs +1 -2
- package/sdk-core/core/src/worker/workflow/machines/child_workflow_state_machine.rs +1 -1
- package/sdk-core/core/src/worker/workflow/machines/nexus_operation_state_machine.rs +31 -48
- package/sdk-core/core/src/worker/workflow/machines/signal_external_state_machine.rs +1 -2
- package/sdk-core/core/src/worker/workflow/machines/upsert_search_attributes_state_machine.rs +3 -3
- package/sdk-core/core/src/worker/workflow/machines/workflow_machines.rs +4 -1
- package/sdk-core/core/src/worker/workflow/managed_run.rs +1 -1
- package/sdk-core/core/src/worker/workflow/mod.rs +15 -15
- package/sdk-core/core-api/Cargo.toml +2 -2
- package/sdk-core/core-api/src/envconfig.rs +204 -99
- package/sdk-core/core-api/src/lib.rs +9 -0
- package/sdk-core/core-api/src/telemetry/metrics.rs +548 -100
- package/sdk-core/core-api/src/worker.rs +11 -5
- package/sdk-core/core-c-bridge/Cargo.toml +49 -0
- package/sdk-core/core-c-bridge/build.rs +26 -0
- package/sdk-core/core-c-bridge/include/temporal-sdk-core-c-bridge.h +817 -0
- package/sdk-core/core-c-bridge/src/client.rs +679 -0
- package/sdk-core/core-c-bridge/src/lib.rs +245 -0
- package/sdk-core/core-c-bridge/src/metric.rs +682 -0
- package/sdk-core/core-c-bridge/src/random.rs +61 -0
- package/sdk-core/core-c-bridge/src/runtime.rs +445 -0
- package/sdk-core/core-c-bridge/src/testing.rs +282 -0
- package/sdk-core/core-c-bridge/src/tests/context.rs +644 -0
- package/sdk-core/core-c-bridge/src/tests/mod.rs +178 -0
- package/sdk-core/core-c-bridge/src/tests/utils.rs +108 -0
- package/sdk-core/core-c-bridge/src/worker.rs +1069 -0
- package/sdk-core/etc/deps.svg +64 -64
- package/sdk-core/sdk/src/activity_context.rs +6 -4
- package/sdk-core/sdk/src/lib.rs +49 -27
- package/sdk-core/sdk/src/workflow_future.rs +18 -25
- package/sdk-core/sdk-core-protos/protos/api_upstream/README.md +4 -0
- package/sdk-core/sdk-core-protos/protos/api_upstream/buf.yaml +0 -2
- package/sdk-core/sdk-core-protos/protos/api_upstream/openapi/openapiv2.json +630 -83
- package/sdk-core/sdk-core-protos/protos/api_upstream/openapi/openapiv3.yaml +632 -78
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/batch/v1/message.proto +4 -4
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/command/v1/message.proto +6 -4
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/common/v1/message.proto +2 -2
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/deployment/v1/message.proto +32 -2
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/enums/v1/common.proto +10 -1
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/enums/v1/deployment.proto +26 -0
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/enums/v1/failed_cause.proto +2 -0
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/enums/v1/reset.proto +4 -4
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/failure/v1/message.proto +2 -2
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/history/v1/message.proto +47 -31
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/nexus/v1/message.proto +4 -4
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/schedule/v1/message.proto +7 -1
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/worker/v1/message.proto +134 -0
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/workflow/v1/message.proto +14 -11
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/workflowservice/v1/request_response.proto +148 -37
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/workflowservice/v1/service.proto +21 -0
- package/sdk-core/sdk-core-protos/protos/local/temporal/sdk/core/workflow_activation/workflow_activation.proto +4 -4
- package/sdk-core/sdk-core-protos/src/history_builder.rs +9 -5
- package/sdk-core/sdk-core-protos/src/lib.rs +96 -6
- package/sdk-core/test-utils/src/lib.rs +11 -3
- package/sdk-core/tests/cloud_tests.rs +3 -3
- package/sdk-core/tests/heavy_tests.rs +11 -3
- package/sdk-core/tests/integ_tests/client_tests.rs +12 -13
- package/sdk-core/tests/integ_tests/ephemeral_server_tests.rs +1 -1
- package/sdk-core/tests/integ_tests/metrics_tests.rs +188 -83
- package/sdk-core/tests/integ_tests/polling_tests.rs +1 -1
- package/sdk-core/tests/integ_tests/queries_tests.rs +56 -40
- package/sdk-core/tests/integ_tests/update_tests.rs +2 -7
- package/sdk-core/tests/integ_tests/worker_tests.rs +3 -4
- package/sdk-core/tests/integ_tests/worker_versioning_tests.rs +3 -7
- package/sdk-core/tests/integ_tests/workflow_tests/local_activities.rs +3 -5
- package/sdk-core/tests/integ_tests/workflow_tests/nexus.rs +24 -17
- package/src/client.rs +6 -0
- package/src/metrics.rs +6 -6
|
@@ -16,7 +16,7 @@ use temporal_sdk_core_protos::{
|
|
|
16
16
|
temporal::api::{
|
|
17
17
|
common::v1::{Callback, callback},
|
|
18
18
|
enums::v1::NexusHandlerErrorRetryBehavior,
|
|
19
|
-
failure::v1::failure::FailureInfo,
|
|
19
|
+
failure::v1::{Failure, failure::FailureInfo},
|
|
20
20
|
nexus,
|
|
21
21
|
nexus::v1::{
|
|
22
22
|
CancelOperationResponse, HandlerError, StartOperationResponse, request,
|
|
@@ -55,7 +55,7 @@ async fn nexus_basic(
|
|
|
55
55
|
worker.register_wf(wf_name.to_owned(), move |ctx: WfContext| {
|
|
56
56
|
let endpoint = endpoint.clone();
|
|
57
57
|
async move {
|
|
58
|
-
|
|
58
|
+
match ctx
|
|
59
59
|
.start_nexus_operation(NexusOperationOptions {
|
|
60
60
|
endpoint,
|
|
61
61
|
service: "svc".to_string(),
|
|
@@ -64,10 +64,14 @@ async fn nexus_basic(
|
|
|
64
64
|
..Default::default()
|
|
65
65
|
})
|
|
66
66
|
.await
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
67
|
+
{
|
|
68
|
+
Ok(started) => {
|
|
69
|
+
assert_eq!(started.operation_token, None);
|
|
70
|
+
let res = started.result().await;
|
|
71
|
+
Ok(Ok(res).into())
|
|
72
|
+
}
|
|
73
|
+
Err(failure) => Ok(Err(failure).into()),
|
|
74
|
+
}
|
|
71
75
|
}
|
|
72
76
|
});
|
|
73
77
|
let wf_handle = starter.start_with_worker(wf_name, &mut worker).await;
|
|
@@ -140,29 +144,30 @@ async fn nexus_basic(
|
|
|
140
144
|
.get_workflow_result(Default::default())
|
|
141
145
|
.await
|
|
142
146
|
.unwrap();
|
|
143
|
-
let res = NexusOperationResult
|
|
147
|
+
let res = Result::<NexusOperationResult, Failure>::from_json_payload(&res.unwrap_success()[0])
|
|
148
|
+
.unwrap();
|
|
144
149
|
match outcome {
|
|
145
150
|
Outcome::Succeed => {
|
|
146
151
|
let p = assert_matches!(
|
|
147
|
-
res.status,
|
|
152
|
+
res.unwrap().status,
|
|
148
153
|
Some(nexus_operation_result::Status::Completed(p)) => p
|
|
149
154
|
);
|
|
150
155
|
assert_eq!(p.data, b"yay");
|
|
151
156
|
}
|
|
152
157
|
Outcome::Fail => {
|
|
153
|
-
let f =
|
|
154
|
-
res.status,
|
|
155
|
-
Some(nexus_operation_result::Status::Failed(f)) => f
|
|
156
|
-
);
|
|
158
|
+
let f = res.unwrap_err();
|
|
157
159
|
assert_eq!(f.message, "nexus operation completed unsuccessfully");
|
|
158
160
|
}
|
|
159
161
|
Outcome::Timeout => {
|
|
160
|
-
let f =
|
|
161
|
-
res.status,
|
|
162
|
-
Some(nexus_operation_result::Status::TimedOut(f)) => f
|
|
163
|
-
);
|
|
162
|
+
let f = res.unwrap_err();
|
|
164
163
|
assert_eq!(f.message, "nexus operation completed unsuccessfully");
|
|
165
|
-
|
|
164
|
+
let cause = f.cause.unwrap();
|
|
165
|
+
assert_eq!(cause.message, "operation timed out");
|
|
166
|
+
assert_matches!(
|
|
167
|
+
f.failure_info,
|
|
168
|
+
Some(FailureInfo::NexusOperationExecutionFailureInfo(_))
|
|
169
|
+
);
|
|
170
|
+
assert_matches!(cause.failure_info, Some(FailureInfo::TimeoutFailureInfo(_)));
|
|
166
171
|
}
|
|
167
172
|
_ => unreachable!(),
|
|
168
173
|
}
|
|
@@ -303,6 +308,7 @@ async fn nexus_async(
|
|
|
303
308
|
variant: Some(nexus::v1::response::Variant::StartOperation(
|
|
304
309
|
StartOperationResponse {
|
|
305
310
|
variant: Some(start_operation_response::Variant::AsyncSuccess(
|
|
311
|
+
#[allow(deprecated)]
|
|
306
312
|
start_operation_response::Async {
|
|
307
313
|
operation_id: "op-1".to_string(),
|
|
308
314
|
links: vec![],
|
|
@@ -644,6 +650,7 @@ async fn nexus_cancellation_types(
|
|
|
644
650
|
variant: Some(nexus::v1::response::Variant::StartOperation(
|
|
645
651
|
StartOperationResponse {
|
|
646
652
|
variant: Some(start_operation_response::Variant::AsyncSuccess(
|
|
653
|
+
#[allow(deprecated)]
|
|
647
654
|
start_operation_response::Async {
|
|
648
655
|
operation_id: "op-1".to_string(),
|
|
649
656
|
links: vec![],
|
package/src/client.rs
CHANGED
|
@@ -272,6 +272,9 @@ async fn client_invoke(mut retry_client: CoreClient, call: RpcCall) -> BridgeRes
|
|
|
272
272
|
"ListWorkerDeployments" => {
|
|
273
273
|
rpc_call!(retry_client, call, list_worker_deployments)
|
|
274
274
|
}
|
|
275
|
+
"ListWorkers" => {
|
|
276
|
+
rpc_call!(retry_client, call, list_workers)
|
|
277
|
+
}
|
|
275
278
|
"ListWorkflowExecutions" => {
|
|
276
279
|
rpc_call!(retry_client, call, list_workflow_executions)
|
|
277
280
|
}
|
|
@@ -301,6 +304,9 @@ async fn client_invoke(mut retry_client: CoreClient, call: RpcCall) -> BridgeRes
|
|
|
301
304
|
"RecordActivityTaskHeartbeatById" => {
|
|
302
305
|
rpc_call!(retry_client, call, record_activity_task_heartbeat_by_id)
|
|
303
306
|
}
|
|
307
|
+
"RecordWorkerHeartbeat" => {
|
|
308
|
+
rpc_call!(retry_client, call, record_worker_heartbeat)
|
|
309
|
+
}
|
|
304
310
|
"RegisterNamespace" => rpc_call!(retry_client, call, register_namespace),
|
|
305
311
|
"RequestCancelWorkflowExecution" => {
|
|
306
312
|
rpc_call!(retry_client, call, request_cancel_workflow_execution)
|
package/src/metrics.rs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
use std::
|
|
1
|
+
use std::collections::HashMap;
|
|
2
2
|
|
|
3
3
|
use anyhow::Context as _;
|
|
4
4
|
use neon::prelude::*;
|
|
@@ -44,32 +44,32 @@ pub fn init(cx: &mut neon::prelude::ModuleContext) -> neon::prelude::NeonResult<
|
|
|
44
44
|
|
|
45
45
|
pub struct Counter {
|
|
46
46
|
pub(crate) meter: TemporalMeter,
|
|
47
|
-
pub(crate) counter:
|
|
47
|
+
pub(crate) counter: CoreCounter,
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
impl MutableFinalize for Counter {}
|
|
51
51
|
|
|
52
52
|
pub struct Histogram {
|
|
53
53
|
pub(crate) meter: TemporalMeter,
|
|
54
|
-
pub(crate) histogram:
|
|
54
|
+
pub(crate) histogram: CoreHistogram,
|
|
55
55
|
}
|
|
56
56
|
impl MutableFinalize for Histogram {}
|
|
57
57
|
|
|
58
58
|
pub struct HistogramF64 {
|
|
59
59
|
pub(crate) meter: TemporalMeter,
|
|
60
|
-
pub(crate) histogram:
|
|
60
|
+
pub(crate) histogram: CoreHistogramF64,
|
|
61
61
|
}
|
|
62
62
|
impl MutableFinalize for HistogramF64 {}
|
|
63
63
|
|
|
64
64
|
pub struct Gauge {
|
|
65
65
|
pub(crate) meter: TemporalMeter,
|
|
66
|
-
pub(crate) gauge:
|
|
66
|
+
pub(crate) gauge: CoreGauge,
|
|
67
67
|
}
|
|
68
68
|
impl MutableFinalize for Gauge {}
|
|
69
69
|
|
|
70
70
|
pub struct GaugeF64 {
|
|
71
71
|
pub(crate) meter: TemporalMeter,
|
|
72
|
-
pub(crate) gauge:
|
|
72
|
+
pub(crate) gauge: CoreGaugeF64,
|
|
73
73
|
}
|
|
74
74
|
impl MutableFinalize for GaugeF64 {}
|
|
75
75
|
|