@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
|
@@ -1810,6 +1810,7 @@ pub mod temporal {
|
|
|
1810
1810
|
)
|
|
1811
1811
|
}
|
|
1812
1812
|
|
|
1813
|
+
#[allow(deprecated)]
|
|
1813
1814
|
pub fn start_child_workflow_cmd_to_api(
|
|
1814
1815
|
s: workflow_commands::StartChildWorkflowExecution,
|
|
1815
1816
|
inherit_build_id: bool,
|
|
@@ -1860,6 +1861,7 @@ pub mod temporal {
|
|
|
1860
1861
|
}
|
|
1861
1862
|
}
|
|
1862
1863
|
|
|
1864
|
+
#[allow(deprecated)]
|
|
1863
1865
|
pub fn continue_as_new_cmd_to_api(
|
|
1864
1866
|
c: workflow_commands::ContinueAsNewWorkflowExecution,
|
|
1865
1867
|
inherit_build_id: bool,
|
|
@@ -2261,6 +2263,78 @@ pub mod temporal {
|
|
|
2261
2263
|
_ => false,
|
|
2262
2264
|
}
|
|
2263
2265
|
}
|
|
2266
|
+
|
|
2267
|
+
pub fn is_ignorable(&self) -> bool {
|
|
2268
|
+
if !self.worker_may_ignore {
|
|
2269
|
+
return false;
|
|
2270
|
+
}
|
|
2271
|
+
// Never add a catch-all case to this match statement. We need to explicitly
|
|
2272
|
+
// mark any new event types as ignorable or not.
|
|
2273
|
+
if let Some(a) = self.attributes.as_ref() {
|
|
2274
|
+
match a {
|
|
2275
|
+
Attributes::WorkflowExecutionStartedEventAttributes(_) => false,
|
|
2276
|
+
Attributes::WorkflowExecutionCompletedEventAttributes(_) => false,
|
|
2277
|
+
Attributes::WorkflowExecutionFailedEventAttributes(_) => false,
|
|
2278
|
+
Attributes::WorkflowExecutionTimedOutEventAttributes(_) => false,
|
|
2279
|
+
Attributes::WorkflowTaskScheduledEventAttributes(_) => false,
|
|
2280
|
+
Attributes::WorkflowTaskStartedEventAttributes(_) => false,
|
|
2281
|
+
Attributes::WorkflowTaskCompletedEventAttributes(_) => false,
|
|
2282
|
+
Attributes::WorkflowTaskTimedOutEventAttributes(_) => false,
|
|
2283
|
+
Attributes::WorkflowTaskFailedEventAttributes(_) => false,
|
|
2284
|
+
Attributes::ActivityTaskScheduledEventAttributes(_) => false,
|
|
2285
|
+
Attributes::ActivityTaskStartedEventAttributes(_) => false,
|
|
2286
|
+
Attributes::ActivityTaskCompletedEventAttributes(_) => false,
|
|
2287
|
+
Attributes::ActivityTaskFailedEventAttributes(_) => false,
|
|
2288
|
+
Attributes::ActivityTaskTimedOutEventAttributes(_) => false,
|
|
2289
|
+
Attributes::TimerStartedEventAttributes(_) => false,
|
|
2290
|
+
Attributes::TimerFiredEventAttributes(_) => false,
|
|
2291
|
+
Attributes::ActivityTaskCancelRequestedEventAttributes(_) => false,
|
|
2292
|
+
Attributes::ActivityTaskCanceledEventAttributes(_) => false,
|
|
2293
|
+
Attributes::TimerCanceledEventAttributes(_) => false,
|
|
2294
|
+
Attributes::MarkerRecordedEventAttributes(_) => false,
|
|
2295
|
+
Attributes::WorkflowExecutionSignaledEventAttributes(_) => false,
|
|
2296
|
+
Attributes::WorkflowExecutionTerminatedEventAttributes(_) => false,
|
|
2297
|
+
Attributes::WorkflowExecutionCancelRequestedEventAttributes(_) => false,
|
|
2298
|
+
Attributes::WorkflowExecutionCanceledEventAttributes(_) => false,
|
|
2299
|
+
Attributes::RequestCancelExternalWorkflowExecutionInitiatedEventAttributes(_) => false,
|
|
2300
|
+
Attributes::RequestCancelExternalWorkflowExecutionFailedEventAttributes(_) => false,
|
|
2301
|
+
Attributes::ExternalWorkflowExecutionCancelRequestedEventAttributes(_) => false,
|
|
2302
|
+
Attributes::WorkflowExecutionContinuedAsNewEventAttributes(_) => false,
|
|
2303
|
+
Attributes::StartChildWorkflowExecutionInitiatedEventAttributes(_) => false,
|
|
2304
|
+
Attributes::StartChildWorkflowExecutionFailedEventAttributes(_) => false,
|
|
2305
|
+
Attributes::ChildWorkflowExecutionStartedEventAttributes(_) => false,
|
|
2306
|
+
Attributes::ChildWorkflowExecutionCompletedEventAttributes(_) => false,
|
|
2307
|
+
Attributes::ChildWorkflowExecutionFailedEventAttributes(_) => false,
|
|
2308
|
+
Attributes::ChildWorkflowExecutionCanceledEventAttributes(_) => false,
|
|
2309
|
+
Attributes::ChildWorkflowExecutionTimedOutEventAttributes(_) => false,
|
|
2310
|
+
Attributes::ChildWorkflowExecutionTerminatedEventAttributes(_) => false,
|
|
2311
|
+
Attributes::SignalExternalWorkflowExecutionInitiatedEventAttributes(_) => false,
|
|
2312
|
+
Attributes::SignalExternalWorkflowExecutionFailedEventAttributes(_) => false,
|
|
2313
|
+
Attributes::ExternalWorkflowExecutionSignaledEventAttributes(_) => false,
|
|
2314
|
+
Attributes::UpsertWorkflowSearchAttributesEventAttributes(_) => false,
|
|
2315
|
+
Attributes::WorkflowExecutionUpdateAcceptedEventAttributes(_) => false,
|
|
2316
|
+
Attributes::WorkflowExecutionUpdateRejectedEventAttributes(_) => false,
|
|
2317
|
+
Attributes::WorkflowExecutionUpdateCompletedEventAttributes(_) => false,
|
|
2318
|
+
Attributes::WorkflowPropertiesModifiedExternallyEventAttributes(_) => false,
|
|
2319
|
+
Attributes::ActivityPropertiesModifiedExternallyEventAttributes(_) => false,
|
|
2320
|
+
Attributes::WorkflowPropertiesModifiedEventAttributes(_) => false,
|
|
2321
|
+
Attributes::WorkflowExecutionUpdateAdmittedEventAttributes(_) => false,
|
|
2322
|
+
Attributes::NexusOperationScheduledEventAttributes(_) => false,
|
|
2323
|
+
Attributes::NexusOperationStartedEventAttributes(_) => false,
|
|
2324
|
+
Attributes::NexusOperationCompletedEventAttributes(_) => false,
|
|
2325
|
+
Attributes::NexusOperationFailedEventAttributes(_) => false,
|
|
2326
|
+
Attributes::NexusOperationCanceledEventAttributes(_) => false,
|
|
2327
|
+
Attributes::NexusOperationTimedOutEventAttributes(_) => false,
|
|
2328
|
+
Attributes::NexusOperationCancelRequestedEventAttributes(_) => false,
|
|
2329
|
+
// !! Ignorable !!
|
|
2330
|
+
Attributes::WorkflowExecutionOptionsUpdatedEventAttributes(_) => true,
|
|
2331
|
+
Attributes::NexusOperationCancelRequestCompletedEventAttributes(_) => false,
|
|
2332
|
+
Attributes::NexusOperationCancelRequestFailedEventAttributes(_) => false,
|
|
2333
|
+
}
|
|
2334
|
+
} else {
|
|
2335
|
+
false
|
|
2336
|
+
}
|
|
2337
|
+
}
|
|
2264
2338
|
}
|
|
2265
2339
|
|
|
2266
2340
|
impl Display for HistoryEvent {
|
|
@@ -2429,6 +2503,11 @@ pub mod temporal {
|
|
|
2429
2503
|
tonic::include_proto!("temporal.api.version.v1");
|
|
2430
2504
|
}
|
|
2431
2505
|
}
|
|
2506
|
+
pub mod worker {
|
|
2507
|
+
pub mod v1 {
|
|
2508
|
+
tonic::include_proto!("temporal.api.worker.v1");
|
|
2509
|
+
}
|
|
2510
|
+
}
|
|
2432
2511
|
pub mod workflow {
|
|
2433
2512
|
pub mod v1 {
|
|
2434
2513
|
tonic::include_proto!("temporal.api.workflow.v1");
|
|
@@ -2436,10 +2515,13 @@ pub mod temporal {
|
|
|
2436
2515
|
}
|
|
2437
2516
|
pub mod nexus {
|
|
2438
2517
|
pub mod v1 {
|
|
2439
|
-
use crate::
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2518
|
+
use crate::{
|
|
2519
|
+
camel_case_to_screaming_snake,
|
|
2520
|
+
temporal::api::{
|
|
2521
|
+
common,
|
|
2522
|
+
common::v1::link::{WorkflowEvent, workflow_event},
|
|
2523
|
+
enums::v1::EventType,
|
|
2524
|
+
},
|
|
2443
2525
|
};
|
|
2444
2526
|
use anyhow::{anyhow, bail};
|
|
2445
2527
|
use std::fmt::{Display, Formatter};
|
|
@@ -2533,12 +2615,20 @@ pub mod temporal {
|
|
|
2533
2615
|
})?;
|
|
2534
2616
|
}
|
|
2535
2617
|
"eventType" => {
|
|
2536
|
-
eventref.event_type =
|
|
2537
|
-
|
|
2618
|
+
eventref.event_type = EventType::from_str_name(val)
|
|
2619
|
+
.unwrap_or_else(|| {
|
|
2620
|
+
EventType::from_str_name(
|
|
2621
|
+
&("EVENT_TYPE_".to_string()
|
|
2622
|
+
+ &camel_case_to_screaming_snake(val)),
|
|
2623
|
+
)
|
|
2624
|
+
.unwrap_or_default()
|
|
2625
|
+
})
|
|
2626
|
+
.into()
|
|
2538
2627
|
}
|
|
2539
2628
|
_ => continue,
|
|
2540
2629
|
}
|
|
2541
2630
|
}
|
|
2631
|
+
dbg!(&eventref);
|
|
2542
2632
|
Some(workflow_event::Reference::EventRef(eventref))
|
|
2543
2633
|
} else {
|
|
2544
2634
|
None
|
|
@@ -18,6 +18,7 @@ use parking_lot::Mutex;
|
|
|
18
18
|
use prost::Message;
|
|
19
19
|
use rand::Rng;
|
|
20
20
|
use std::{
|
|
21
|
+
cell::Cell,
|
|
21
22
|
convert::TryFrom,
|
|
22
23
|
env,
|
|
23
24
|
future::Future,
|
|
@@ -171,9 +172,16 @@ pub async fn history_from_proto_binary(path_from_root: &str) -> Result<History,
|
|
|
171
172
|
Ok(History::decode(&*bytes)?)
|
|
172
173
|
}
|
|
173
174
|
|
|
175
|
+
thread_local! {
|
|
176
|
+
/// Can be set true to disable auto-initialization of integ-test telemetry.
|
|
177
|
+
pub static DONT_AUTO_INIT_INTEG_TELEM: Cell<bool> = const { Cell::new(false) };
|
|
178
|
+
}
|
|
174
179
|
static INTEG_TESTS_RT: std::sync::OnceLock<CoreRuntime> = std::sync::OnceLock::new();
|
|
175
|
-
pub fn init_integ_telem() ->
|
|
176
|
-
|
|
180
|
+
pub fn init_integ_telem() -> Option<&'static CoreRuntime> {
|
|
181
|
+
if DONT_AUTO_INIT_INTEG_TELEM.get() {
|
|
182
|
+
return None;
|
|
183
|
+
}
|
|
184
|
+
Some(INTEG_TESTS_RT.get_or_init(|| {
|
|
177
185
|
let telemetry_options = get_integ_telem_options();
|
|
178
186
|
let rt =
|
|
179
187
|
CoreRuntime::new_assume_tokio(telemetry_options).expect("Core runtime inits cleanly");
|
|
@@ -181,7 +189,7 @@ pub fn init_integ_telem() -> &'static CoreRuntime {
|
|
|
181
189
|
let _ = tracing::subscriber::set_global_default(sub);
|
|
182
190
|
}
|
|
183
191
|
rt
|
|
184
|
-
})
|
|
192
|
+
}))
|
|
185
193
|
}
|
|
186
194
|
|
|
187
195
|
/// Implements a builder pattern to help integ tests initialize core and create workflows
|
|
@@ -8,7 +8,7 @@ use temporal_client::{
|
|
|
8
8
|
};
|
|
9
9
|
use temporal_sdk::WfContext;
|
|
10
10
|
use temporal_sdk_core_protos::temporal::api::{
|
|
11
|
-
enums::v1::{EventType, WorkflowTaskFailedCause::
|
|
11
|
+
enums::v1::{EventType, WorkflowTaskFailedCause::GrpcMessageTooLarge},
|
|
12
12
|
history::v1::history_event::Attributes::WorkflowTaskFailedEventAttributes,
|
|
13
13
|
};
|
|
14
14
|
use temporal_sdk_core_test_utils::CoreWfStarter;
|
|
@@ -27,6 +27,7 @@ async fn get_client(client_name: &str) -> RetryClient<Client> {
|
|
|
27
27
|
.target_url(Url::from_str(&cloud_addr).unwrap())
|
|
28
28
|
.client_name(client_name)
|
|
29
29
|
.client_version("clientver")
|
|
30
|
+
.identity("sdk-test-client")
|
|
30
31
|
.tls_cfg(TlsConfig {
|
|
31
32
|
client_tls_config: Some(ClientTlsConfig {
|
|
32
33
|
client_cert,
|
|
@@ -76,8 +77,7 @@ async fn grpc_message_too_large_test() {
|
|
|
76
77
|
assert!(starter.get_history().await.events.iter().any(|e| {
|
|
77
78
|
e.event_type == EventType::WorkflowTaskFailed as i32
|
|
78
79
|
&& if let WorkflowTaskFailedEventAttributes(attr) = e.attributes.as_ref().unwrap() {
|
|
79
|
-
|
|
80
|
-
attr.cause == WorkflowWorkerUnhandledFailure as i32
|
|
80
|
+
attr.cause == GrpcMessageTooLarge as i32
|
|
81
81
|
&& attr.failure.as_ref().unwrap().message == "GRPC Message too large"
|
|
82
82
|
} else {
|
|
83
83
|
false
|
|
@@ -12,13 +12,15 @@ use std::{
|
|
|
12
12
|
};
|
|
13
13
|
use temporal_client::{GetWorkflowResultOpts, WfClientExt, WorkflowClientTrait, WorkflowOptions};
|
|
14
14
|
use temporal_sdk::{ActContext, ActivityOptions, WfContext, WorkflowResult};
|
|
15
|
-
use temporal_sdk_core::{ResourceBasedTuner, ResourceSlotOptions};
|
|
15
|
+
use temporal_sdk_core::{CoreRuntime, ResourceBasedTuner, ResourceSlotOptions};
|
|
16
16
|
use temporal_sdk_core_api::worker::PollerBehavior;
|
|
17
17
|
use temporal_sdk_core_protos::{
|
|
18
18
|
coresdk::{AsJsonPayloadExt, workflow_commands::ActivityCancellationType},
|
|
19
19
|
temporal::api::enums::v1::WorkflowIdReusePolicy,
|
|
20
20
|
};
|
|
21
|
-
use temporal_sdk_core_test_utils::{
|
|
21
|
+
use temporal_sdk_core_test_utils::{
|
|
22
|
+
CoreWfStarter, init_integ_telem, prom_metrics, rand_6_chars, workflows::la_problem_workflow,
|
|
23
|
+
};
|
|
22
24
|
|
|
23
25
|
mod fuzzy_workflow;
|
|
24
26
|
|
|
@@ -183,7 +185,13 @@ async fn workflow_load() {
|
|
|
183
185
|
const SIGNAME: &str = "signame";
|
|
184
186
|
let num_workflows = 500;
|
|
185
187
|
let wf_name = "workflow_load";
|
|
186
|
-
let mut
|
|
188
|
+
let (mut telemopts, _, _aborter) = prom_metrics(None);
|
|
189
|
+
// Avoid initting two logging systems, since when this test is run with others it can
|
|
190
|
+
// cause us to encounter the tracing span drop bug
|
|
191
|
+
telemopts.logging = None;
|
|
192
|
+
init_integ_telem();
|
|
193
|
+
let rt = CoreRuntime::new_assume_tokio(telemopts).unwrap();
|
|
194
|
+
let mut starter = CoreWfStarter::new_with_runtime("workflow_load", rt);
|
|
187
195
|
starter
|
|
188
196
|
.worker_config
|
|
189
197
|
.max_outstanding_workflow_tasks(5_usize)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
use assert_matches::assert_matches;
|
|
2
2
|
use futures_util::{FutureExt, future::BoxFuture};
|
|
3
|
-
use http_body_util::
|
|
3
|
+
use http_body_util::Full;
|
|
4
4
|
use prost::Message;
|
|
5
5
|
use std::{
|
|
6
6
|
collections::HashMap,
|
|
@@ -30,7 +30,7 @@ use tokio::{
|
|
|
30
30
|
};
|
|
31
31
|
use tonic::{
|
|
32
32
|
Code, Request, Status,
|
|
33
|
-
body::
|
|
33
|
+
body::Body,
|
|
34
34
|
codegen::{Service, http::Response},
|
|
35
35
|
server::NamedService,
|
|
36
36
|
transport::Server,
|
|
@@ -108,11 +108,11 @@ struct GenericService<F> {
|
|
|
108
108
|
header_tx: UnboundedSender<String>,
|
|
109
109
|
response_maker: F,
|
|
110
110
|
}
|
|
111
|
-
impl<F> Service<tonic::codegen::http::Request<
|
|
111
|
+
impl<F> Service<tonic::codegen::http::Request<Body>> for GenericService<F>
|
|
112
112
|
where
|
|
113
|
-
F: FnMut() -> Response<
|
|
113
|
+
F: FnMut() -> Response<Body>,
|
|
114
114
|
{
|
|
115
|
-
type Response = Response<
|
|
115
|
+
type Response = Response<Body>;
|
|
116
116
|
type Error = Infallible;
|
|
117
117
|
type Future = BoxFuture<'static, Result<Self::Response, Self::Error>>;
|
|
118
118
|
|
|
@@ -120,7 +120,7 @@ where
|
|
|
120
120
|
Poll::Ready(Ok(()))
|
|
121
121
|
}
|
|
122
122
|
|
|
123
|
-
fn call(&mut self, req: tonic::codegen::http::Request<
|
|
123
|
+
fn call(&mut self, req: tonic::codegen::http::Request<Body>) -> Self::Future {
|
|
124
124
|
self.header_tx
|
|
125
125
|
.send(
|
|
126
126
|
String::from_utf8_lossy(
|
|
@@ -149,7 +149,7 @@ struct FakeServer {
|
|
|
149
149
|
|
|
150
150
|
async fn fake_server<F>(response_maker: F) -> FakeServer
|
|
151
151
|
where
|
|
152
|
-
F: FnMut() -> Response<
|
|
152
|
+
F: FnMut() -> Response<Body> + Clone + Send + Sync + 'static,
|
|
153
153
|
{
|
|
154
154
|
let (shutdown_tx, shutdown_rx) = oneshot::channel::<()>();
|
|
155
155
|
let (header_tx, header_rx) = tokio::sync::mpsc::unbounded_channel();
|
|
@@ -191,7 +191,7 @@ impl FakeServer {
|
|
|
191
191
|
|
|
192
192
|
#[tokio::test]
|
|
193
193
|
async fn timeouts_respected_one_call_fake_server() {
|
|
194
|
-
let mut fs = fake_server(|| Response::new(
|
|
194
|
+
let mut fs = fake_server(|| Response::new(Body::empty())).await;
|
|
195
195
|
let header_rx = &mut fs.header_rx;
|
|
196
196
|
|
|
197
197
|
let mut opts = get_integ_server_options();
|
|
@@ -335,7 +335,7 @@ async fn namespace_header_attached_to_relevant_calls() {
|
|
|
335
335
|
.add_service(GenericService {
|
|
336
336
|
header_to_parse: "Temporal-Namespace",
|
|
337
337
|
header_tx,
|
|
338
|
-
response_maker: || Response::new(
|
|
338
|
+
response_maker: || Response::new(Body::empty()),
|
|
339
339
|
})
|
|
340
340
|
.serve_with_incoming_shutdown(
|
|
341
341
|
tokio_stream::wrappers::TcpListenerStream::new(listener),
|
|
@@ -409,7 +409,7 @@ async fn cloud_ops_test() {
|
|
|
409
409
|
assert_eq!(res.into_inner().namespace.unwrap().namespace, namespace);
|
|
410
410
|
}
|
|
411
411
|
|
|
412
|
-
fn make_ok_response<T>(message: T) -> Response<
|
|
412
|
+
fn make_ok_response<T>(message: T) -> Response<Body>
|
|
413
413
|
where
|
|
414
414
|
T: Message,
|
|
415
415
|
{
|
|
@@ -425,9 +425,8 @@ where
|
|
|
425
425
|
let len = buf.len() as u32;
|
|
426
426
|
frame.extend_from_slice(&len.to_be_bytes());
|
|
427
427
|
frame.extend_from_slice(&buf);
|
|
428
|
-
let full_body =
|
|
429
|
-
|
|
430
|
-
let body = BoxBody::new(full_body);
|
|
428
|
+
let full_body = Full::new(frame.into());
|
|
429
|
+
let body = Body::new(full_body);
|
|
431
430
|
|
|
432
431
|
// Build the HTTP response with the required gRPC headers.
|
|
433
432
|
Response::builder()
|
|
@@ -3,7 +3,6 @@ use std::time::{SystemTime, UNIX_EPOCH};
|
|
|
3
3
|
use temporal_client::{ClientOptionsBuilder, TestService, WorkflowService};
|
|
4
4
|
use temporal_sdk_core::ephemeral_server::{
|
|
5
5
|
EphemeralExe, EphemeralExeVersion, EphemeralServer, TemporalDevServerConfigBuilder,
|
|
6
|
-
TestServerConfigBuilder,
|
|
7
6
|
};
|
|
8
7
|
use temporal_sdk_core_protos::temporal::api::workflowservice::v1::DescribeNamespaceRequest;
|
|
9
8
|
use temporal_sdk_core_test_utils::{NAMESPACE, default_cached_download};
|
|
@@ -84,6 +83,7 @@ async fn temporal_cli_concurrent_starts() -> Result<(), Box<dyn std::error::Erro
|
|
|
84
83
|
#[cfg(not(all(target_os = "linux", any(target_arch = "arm", target_arch = "aarch64"))))]
|
|
85
84
|
mod test_server {
|
|
86
85
|
use super::*;
|
|
86
|
+
use temporal_sdk_core::ephemeral_server::TestServerConfigBuilder;
|
|
87
87
|
|
|
88
88
|
#[tokio::test]
|
|
89
89
|
async fn test_server_default() {
|