1+ use crate :: common:: get_integ_runtime_options;
12use crate :: {
23 common:: {
34 ANY_PORT , CoreWfStarter , NAMESPACE , OTEL_URL_ENV_VAR , PROMETHEUS_QUERY_API ,
@@ -22,8 +23,7 @@ use temporal_sdk::{
2223 NexusOperationOptions , WfContext ,
2324} ;
2425use temporal_sdk_core:: {
25- CoreRuntime , FixedSizeSlotSupplier , RuntimeOptionsBuilder , TokioRuntimeBuilder , TunerBuilder ,
26- init_worker,
26+ CoreRuntime , FixedSizeSlotSupplier , TokioRuntimeBuilder , TunerBuilder , init_worker,
2727 telemetry:: { WORKFLOW_TASK_EXECUTION_LATENCY_HISTOGRAM_NAME , build_otlp_metric_exporter} ,
2828} ;
2929use temporal_sdk_core_api:: {
@@ -98,11 +98,7 @@ async fn prometheus_metrics_exported(
9898 } ) ;
9999 }
100100 let ( telemopts, addr, _aborter) = prom_metrics ( Some ( opts_builder. build ( ) . unwrap ( ) ) ) ;
101- let runtimeopts = RuntimeOptionsBuilder :: default ( )
102- . telemetry_options ( telemopts)
103- . build ( )
104- . unwrap ( ) ;
105- let rt = CoreRuntime :: new_assume_tokio ( runtimeopts) . unwrap ( ) ;
101+ let rt = CoreRuntime :: new_assume_tokio ( get_integ_runtime_options ( telemopts) ) . unwrap ( ) ;
106102 let opts = get_integ_server_options ( ) ;
107103 let mut raw_client = opts
108104 . connect_no_namespace ( rt. telemetry ( ) . get_temporal_metric_meter ( ) )
@@ -153,11 +149,7 @@ async fn prometheus_metrics_exported(
153149async fn one_slot_worker_reports_available_slot ( ) {
154150 let ( telemopts, addr, _aborter) = prom_metrics ( None ) ;
155151 let tq = "one_slot_worker_tq" ;
156- let runtimeopts = RuntimeOptionsBuilder :: default ( )
157- . telemetry_options ( telemopts)
158- . build ( )
159- . unwrap ( ) ;
160- let rt = CoreRuntime :: new_assume_tokio ( runtimeopts) . unwrap ( ) ;
152+ let rt = CoreRuntime :: new_assume_tokio ( get_integ_runtime_options ( telemopts) ) . unwrap ( ) ;
161153
162154 let worker_cfg = WorkerConfigBuilder :: default ( )
163155 . namespace ( NAMESPACE )
@@ -410,11 +402,7 @@ async fn query_of_closed_workflow_doesnt_tick_terminal_metric(
410402 completion : workflow_command:: Variant ,
411403) {
412404 let ( telemopts, addr, _aborter) = prom_metrics ( None ) ;
413- let runtimeopts = RuntimeOptionsBuilder :: default ( )
414- . telemetry_options ( telemopts)
415- . build ( )
416- . unwrap ( ) ;
417- let rt = CoreRuntime :: new_assume_tokio ( runtimeopts) . unwrap ( ) ;
405+ let rt = CoreRuntime :: new_assume_tokio ( get_integ_runtime_options ( telemopts) ) . unwrap ( ) ;
418406 let mut starter =
419407 CoreWfStarter :: new_with_runtime ( "query_of_closed_workflow_doesnt_tick_terminal_metric" , rt) ;
420408 // Disable cache to ensure replay happens completely
@@ -536,11 +524,11 @@ async fn query_of_closed_workflow_doesnt_tick_terminal_metric(
536524
537525#[ test]
538526fn runtime_new ( ) {
539- let runtimeopts = RuntimeOptionsBuilder :: default ( )
540- . telemetry_options ( get_integ_telem_options ( ) )
541- . build ( )
542- . unwrap ( ) ;
543- let mut rt = CoreRuntime :: new ( runtimeopts , TokioRuntimeBuilder :: default ( ) ) . unwrap ( ) ;
527+ let mut rt = CoreRuntime :: new (
528+ get_integ_runtime_options ( get_integ_telem_options ( ) ) ,
529+ TokioRuntimeBuilder :: default ( ) ,
530+ )
531+ . unwrap ( ) ;
544532 let handle = rt. tokio_handle ( ) ;
545533 let _rt = handle. enter ( ) ;
546534 let ( telemopts, addr, _aborter) = prom_metrics ( None ) ;
@@ -586,11 +574,7 @@ async fn latency_metrics(
586574 . build ( )
587575 . unwrap ( ) ,
588576 ) ) ;
589- let runtimeopts = RuntimeOptionsBuilder :: default ( )
590- . telemetry_options ( telemopts)
591- . build ( )
592- . unwrap ( ) ;
593- let rt = CoreRuntime :: new_assume_tokio ( runtimeopts) . unwrap ( ) ;
577+ let rt = CoreRuntime :: new_assume_tokio ( get_integ_runtime_options ( telemopts) ) . unwrap ( ) ;
594578 let mut starter = CoreWfStarter :: new_with_runtime ( "latency_metrics" , rt) ;
595579 let worker = starter. get_worker ( ) . await ;
596580 starter. start_wf ( ) . await ;
@@ -644,11 +628,7 @@ async fn latency_metrics(
644628#[ tokio:: test]
645629async fn request_fail_codes ( ) {
646630 let ( telemopts, addr, _aborter) = prom_metrics ( None ) ;
647- let runtimeopts = RuntimeOptionsBuilder :: default ( )
648- . telemetry_options ( telemopts)
649- . build ( )
650- . unwrap ( ) ;
651- let rt = CoreRuntime :: new_assume_tokio ( runtimeopts) . unwrap ( ) ;
631+ let rt = CoreRuntime :: new_assume_tokio ( get_integ_runtime_options ( telemopts) ) . unwrap ( ) ;
652632 let opts = get_integ_server_options ( ) ;
653633 let mut client = opts
654634 . connect ( NAMESPACE , rt. telemetry ( ) . get_temporal_metric_meter ( ) )
@@ -691,11 +671,8 @@ async fn request_fail_codes_otel() {
691671 let mut telemopts = TelemetryOptionsBuilder :: default ( ) ;
692672 let exporter = Arc :: new ( exporter) ;
693673 telemopts. metrics ( exporter as Arc < dyn CoreMeter > ) ;
694- let runtimeopts = RuntimeOptionsBuilder :: default ( )
695- . telemetry_options ( telemopts. build ( ) . unwrap ( ) )
696- . build ( )
674+ let rt = CoreRuntime :: new_assume_tokio ( get_integ_runtime_options ( telemopts. build ( ) . unwrap ( ) ) )
697675 . unwrap ( ) ;
698- let rt = CoreRuntime :: new_assume_tokio ( runtimeopts) . unwrap ( ) ;
699676 let opts = get_integ_server_options ( ) ;
700677 let mut client = opts
701678 . connect ( NAMESPACE , rt. telemetry ( ) . get_temporal_metric_meter ( ) )
@@ -745,11 +722,7 @@ async fn docker_metrics_with_prometheus(
745722 . metric_prefix ( test_uid. clone ( ) )
746723 . build ( )
747724 . unwrap ( ) ;
748- let runtimeopts = RuntimeOptionsBuilder :: default ( )
749- . telemetry_options ( telemopts)
750- . build ( )
751- . unwrap ( ) ;
752- let rt = CoreRuntime :: new_assume_tokio ( runtimeopts) . unwrap ( ) ;
725+ let rt = CoreRuntime :: new_assume_tokio ( get_integ_runtime_options ( telemopts) ) . unwrap ( ) ;
753726 let test_name = "docker_metrics_with_prometheus" ;
754727 let mut starter = CoreWfStarter :: new_with_runtime ( test_name, rt) ;
755728 let worker = starter. get_worker ( ) . await ;
@@ -803,11 +776,7 @@ async fn docker_metrics_with_prometheus(
803776#[ tokio:: test]
804777async fn activity_metrics ( ) {
805778 let ( telemopts, addr, _aborter) = prom_metrics ( None ) ;
806- let runtimeopts = RuntimeOptionsBuilder :: default ( )
807- . telemetry_options ( telemopts)
808- . build ( )
809- . unwrap ( ) ;
810- let rt = CoreRuntime :: new_assume_tokio ( runtimeopts) . unwrap ( ) ;
779+ let rt = CoreRuntime :: new_assume_tokio ( get_integ_runtime_options ( telemopts) ) . unwrap ( ) ;
811780 let wf_name = "activity_metrics" ;
812781 let mut starter = CoreWfStarter :: new_with_runtime ( wf_name, rt) ;
813782 starter
@@ -941,11 +910,7 @@ async fn activity_metrics() {
941910#[ tokio:: test]
942911async fn nexus_metrics ( ) {
943912 let ( telemopts, addr, _aborter) = prom_metrics ( None ) ;
944- let runtimeopts = RuntimeOptionsBuilder :: default ( )
945- . telemetry_options ( telemopts)
946- . build ( )
947- . unwrap ( ) ;
948- let rt = CoreRuntime :: new_assume_tokio ( runtimeopts) . unwrap ( ) ;
913+ let rt = CoreRuntime :: new_assume_tokio ( get_integ_runtime_options ( telemopts) ) . unwrap ( ) ;
949914 let wf_name = "nexus_metrics" ;
950915 let mut starter = CoreWfStarter :: new_with_runtime ( wf_name, rt) ;
951916 starter. worker_config . no_remote_activities ( true ) ;
@@ -1122,11 +1087,7 @@ async fn nexus_metrics() {
11221087#[ tokio:: test]
11231088async fn evict_on_complete_does_not_count_as_forced_eviction ( ) {
11241089 let ( telemopts, addr, _aborter) = prom_metrics ( None ) ;
1125- let runtimeopts = RuntimeOptionsBuilder :: default ( )
1126- . telemetry_options ( telemopts)
1127- . build ( )
1128- . unwrap ( ) ;
1129- let rt = CoreRuntime :: new_assume_tokio ( runtimeopts) . unwrap ( ) ;
1090+ let rt = CoreRuntime :: new_assume_tokio ( get_integ_runtime_options ( telemopts) ) . unwrap ( ) ;
11301091 let wf_name = "evict_on_complete_does_not_count_as_forced_eviction" ;
11311092 let mut starter = CoreWfStarter :: new_with_runtime ( wf_name, rt) ;
11321093 starter. worker_config . no_remote_activities ( true ) ;
@@ -1209,11 +1170,7 @@ where
12091170#[ tokio:: test]
12101171async fn metrics_available_from_custom_slot_supplier ( ) {
12111172 let ( telemopts, addr, _aborter) = prom_metrics ( None ) ;
1212- let runtimeopts = RuntimeOptionsBuilder :: default ( )
1213- . telemetry_options ( telemopts)
1214- . build ( )
1215- . unwrap ( ) ;
1216- let rt = CoreRuntime :: new_assume_tokio ( runtimeopts) . unwrap ( ) ;
1173+ let rt = CoreRuntime :: new_assume_tokio ( get_integ_runtime_options ( telemopts) ) . unwrap ( ) ;
12171174 let mut starter =
12181175 CoreWfStarter :: new_with_runtime ( "metrics_available_from_custom_slot_supplier" , rt) ;
12191176 starter. worker_config . no_remote_activities ( true ) ;
0 commit comments