@temporalio/core-bridge 1.15.0 → 1.16.1

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 (209) hide show
  1. package/Cargo.lock +172 -70
  2. package/lib/native.d.ts +1 -1
  3. package/package.json +2 -2
  4. package/releases/aarch64-apple-darwin/index.node +0 -0
  5. package/releases/aarch64-unknown-linux-gnu/index.node +0 -0
  6. package/releases/x86_64-apple-darwin/index.node +0 -0
  7. package/releases/x86_64-pc-windows-msvc/index.node +0 -0
  8. package/releases/x86_64-unknown-linux-gnu/index.node +0 -0
  9. package/sdk-core/.github/workflows/per-pr.yml +6 -6
  10. package/sdk-core/AGENTS.md +41 -30
  11. package/sdk-core/Cargo.toml +3 -0
  12. package/sdk-core/README.md +15 -9
  13. package/sdk-core/crates/client/Cargo.toml +4 -0
  14. package/sdk-core/crates/client/README.md +139 -0
  15. package/sdk-core/crates/client/src/async_activity_handle.rs +297 -0
  16. package/sdk-core/crates/client/src/callback_based.rs +7 -0
  17. package/sdk-core/crates/client/src/errors.rs +294 -0
  18. package/sdk-core/crates/client/src/{raw.rs → grpc.rs} +280 -159
  19. package/sdk-core/crates/client/src/lib.rs +920 -1326
  20. package/sdk-core/crates/client/src/metrics.rs +24 -33
  21. package/sdk-core/crates/client/src/options_structs.rs +457 -0
  22. package/sdk-core/crates/client/src/replaceable.rs +5 -4
  23. package/sdk-core/crates/client/src/request_extensions.rs +8 -9
  24. package/sdk-core/crates/client/src/retry.rs +99 -54
  25. package/sdk-core/crates/client/src/{worker/mod.rs → worker.rs} +1 -1
  26. package/sdk-core/crates/client/src/workflow_handle.rs +826 -0
  27. package/sdk-core/crates/common/Cargo.toml +61 -2
  28. package/sdk-core/crates/common/build.rs +742 -12
  29. package/sdk-core/crates/common/protos/api_upstream/.github/workflows/ci.yml +2 -0
  30. package/sdk-core/crates/common/protos/api_upstream/Makefile +2 -1
  31. package/sdk-core/crates/common/protos/api_upstream/buf.yaml +0 -3
  32. package/sdk-core/crates/common/protos/api_upstream/cmd/check-path-conflicts/main.go +137 -0
  33. package/sdk-core/crates/common/protos/api_upstream/openapi/openapiv2.json +1166 -770
  34. package/sdk-core/crates/common/protos/api_upstream/openapi/openapiv3.yaml +1243 -750
  35. package/sdk-core/crates/common/protos/api_upstream/temporal/api/deployment/v1/message.proto +2 -2
  36. package/sdk-core/crates/common/protos/api_upstream/temporal/api/enums/v1/workflow.proto +4 -3
  37. package/sdk-core/crates/common/protos/api_upstream/temporal/api/failure/v1/message.proto +1 -0
  38. package/sdk-core/crates/common/protos/api_upstream/temporal/api/history/v1/message.proto +4 -0
  39. package/sdk-core/crates/common/protos/api_upstream/temporal/api/namespace/v1/message.proto +6 -0
  40. package/sdk-core/crates/common/protos/api_upstream/temporal/api/nexus/v1/message.proto +16 -1
  41. package/sdk-core/crates/common/protos/api_upstream/temporal/api/workflowservice/v1/request_response.proto +64 -6
  42. package/sdk-core/crates/common/protos/api_upstream/temporal/api/workflowservice/v1/service.proto +88 -33
  43. package/sdk-core/crates/common/protos/local/temporal/sdk/core/nexus/nexus.proto +4 -2
  44. package/sdk-core/crates/common/protos/local/temporal/sdk/core/workflow_activation/workflow_activation.proto +4 -0
  45. package/sdk-core/crates/common/protos/local/temporal/sdk/core/workflow_commands/workflow_commands.proto +5 -5
  46. package/sdk-core/crates/common/src/activity_definition.rs +20 -0
  47. package/sdk-core/crates/common/src/data_converters.rs +770 -0
  48. package/sdk-core/crates/common/src/envconfig.rs +5 -0
  49. package/sdk-core/crates/common/src/lib.rs +15 -211
  50. package/sdk-core/crates/common/src/payload_visitor.rs +648 -0
  51. package/sdk-core/crates/common/src/priority.rs +110 -0
  52. package/sdk-core/crates/common/src/protos/canned_histories.rs +3 -0
  53. package/sdk-core/crates/common/src/protos/history_builder.rs +45 -0
  54. package/sdk-core/crates/common/src/protos/history_info.rs +2 -0
  55. package/sdk-core/crates/common/src/protos/mod.rs +122 -27
  56. package/sdk-core/crates/common/src/protos/task_token.rs +3 -3
  57. package/sdk-core/crates/common/src/protos/utilities.rs +11 -0
  58. package/sdk-core/crates/{sdk-core → common}/src/telemetry/log_export.rs +5 -7
  59. package/sdk-core/crates/common/src/telemetry/metrics/core.rs +125 -0
  60. package/sdk-core/crates/common/src/telemetry/metrics.rs +268 -223
  61. package/sdk-core/crates/{sdk-core → common}/src/telemetry/otel.rs +8 -13
  62. package/sdk-core/crates/{sdk-core → common}/src/telemetry/prometheus_meter.rs +49 -50
  63. package/sdk-core/crates/{sdk-core → common}/src/telemetry/prometheus_server.rs +2 -3
  64. package/sdk-core/crates/common/src/telemetry.rs +264 -4
  65. package/sdk-core/crates/common/src/worker.rs +68 -603
  66. package/sdk-core/crates/common/src/workflow_definition.rs +60 -0
  67. package/sdk-core/crates/macros/Cargo.toml +5 -1
  68. package/sdk-core/crates/macros/src/activities_definitions.rs +585 -0
  69. package/sdk-core/crates/macros/src/fsm_impl.rs +507 -0
  70. package/sdk-core/crates/macros/src/lib.rs +138 -512
  71. package/sdk-core/crates/macros/src/macro_utils.rs +106 -0
  72. package/sdk-core/crates/macros/src/workflow_definitions.rs +1224 -0
  73. package/sdk-core/crates/sdk/Cargo.toml +19 -6
  74. package/sdk-core/crates/sdk/README.md +415 -0
  75. package/sdk-core/crates/sdk/src/activities.rs +417 -0
  76. package/sdk-core/crates/sdk/src/interceptors.rs +1 -1
  77. package/sdk-core/crates/sdk/src/lib.rs +757 -442
  78. package/sdk-core/crates/sdk/src/workflow_context/options.rs +45 -35
  79. package/sdk-core/crates/sdk/src/workflow_context.rs +1033 -289
  80. package/sdk-core/crates/sdk/src/workflow_future.rs +277 -213
  81. package/sdk-core/crates/sdk/src/workflows.rs +711 -0
  82. package/sdk-core/crates/sdk-core/Cargo.toml +57 -64
  83. package/sdk-core/crates/sdk-core/benches/workflow_replay_bench.rs +41 -35
  84. package/sdk-core/crates/sdk-core/machine_coverage/ActivityMachine_Coverage.puml +1 -1
  85. package/sdk-core/crates/sdk-core/src/abstractions.rs +6 -10
  86. package/sdk-core/crates/sdk-core/src/core_tests/activity_tasks.rs +6 -5
  87. package/sdk-core/crates/sdk-core/src/core_tests/mod.rs +13 -15
  88. package/sdk-core/crates/sdk-core/src/core_tests/queries.rs +21 -25
  89. package/sdk-core/crates/sdk-core/src/core_tests/replay_flag.rs +7 -10
  90. package/sdk-core/crates/sdk-core/src/core_tests/updates.rs +14 -17
  91. package/sdk-core/crates/sdk-core/src/core_tests/workers.rs +493 -26
  92. package/sdk-core/crates/sdk-core/src/core_tests/workflow_tasks.rs +4 -8
  93. package/sdk-core/crates/sdk-core/src/ephemeral_server/mod.rs +7 -7
  94. package/sdk-core/crates/sdk-core/src/histfetch.rs +20 -10
  95. package/sdk-core/crates/sdk-core/src/lib.rs +41 -111
  96. package/sdk-core/crates/sdk-core/src/pollers/mod.rs +4 -9
  97. package/sdk-core/crates/sdk-core/src/pollers/poll_buffer.rs +118 -19
  98. package/sdk-core/crates/sdk-core/src/protosext/mod.rs +2 -2
  99. package/sdk-core/crates/sdk-core/src/replay/mod.rs +14 -5
  100. package/sdk-core/crates/sdk-core/src/telemetry/metrics.rs +179 -196
  101. package/sdk-core/crates/sdk-core/src/telemetry/mod.rs +3 -280
  102. package/sdk-core/crates/sdk-core/src/test_help/integ_helpers.rs +6 -9
  103. package/sdk-core/crates/sdk-core/src/test_help/unit_helpers.rs +3 -6
  104. package/sdk-core/crates/sdk-core/src/worker/activities/local_activities.rs +11 -14
  105. package/sdk-core/crates/sdk-core/src/worker/activities.rs +16 -19
  106. package/sdk-core/crates/sdk-core/src/worker/client/mocks.rs +9 -5
  107. package/sdk-core/crates/sdk-core/src/worker/client.rs +103 -81
  108. package/sdk-core/crates/sdk-core/src/worker/heartbeat.rs +7 -11
  109. package/sdk-core/crates/sdk-core/src/worker/mod.rs +1124 -229
  110. package/sdk-core/crates/sdk-core/src/worker/nexus.rs +145 -23
  111. package/sdk-core/crates/sdk-core/src/worker/slot_provider.rs +2 -2
  112. package/sdk-core/crates/sdk-core/src/worker/tuner/fixed_size.rs +2 -2
  113. package/sdk-core/crates/sdk-core/src/worker/tuner/resource_based.rs +13 -13
  114. package/sdk-core/crates/sdk-core/src/worker/tuner.rs +28 -8
  115. package/sdk-core/crates/sdk-core/src/worker/workflow/driven_workflow.rs +9 -3
  116. package/sdk-core/crates/sdk-core/src/worker/workflow/machines/upsert_search_attributes_state_machine.rs +21 -22
  117. package/sdk-core/crates/sdk-core/src/worker/workflow/machines/workflow_machines.rs +19 -4
  118. package/sdk-core/crates/sdk-core/src/worker/workflow/managed_run.rs +14 -18
  119. package/sdk-core/crates/sdk-core/src/worker/workflow/mod.rs +4 -6
  120. package/sdk-core/crates/sdk-core/src/worker/workflow/run_cache.rs +4 -7
  121. package/sdk-core/crates/sdk-core/src/worker/workflow/wft_extraction.rs +2 -4
  122. package/sdk-core/crates/sdk-core/src/worker/workflow/wft_poller.rs +8 -9
  123. package/sdk-core/crates/sdk-core/src/worker/workflow/workflow_stream.rs +1 -3
  124. package/sdk-core/crates/sdk-core/tests/activities_procmacro.rs +6 -0
  125. package/sdk-core/crates/sdk-core/tests/activities_trybuild/basic_pass.rs +54 -0
  126. package/sdk-core/crates/sdk-core/tests/activities_trybuild/invalid_self_type_fail.rs +18 -0
  127. package/sdk-core/crates/sdk-core/tests/activities_trybuild/invalid_self_type_fail.stderr +5 -0
  128. package/sdk-core/crates/sdk-core/tests/activities_trybuild/missing_context_fail.rs +14 -0
  129. package/sdk-core/crates/sdk-core/tests/activities_trybuild/missing_context_fail.stderr +5 -0
  130. package/sdk-core/crates/sdk-core/tests/activities_trybuild/multi_arg_pass.rs +48 -0
  131. package/sdk-core/crates/sdk-core/tests/activities_trybuild/no_input_pass.rs +14 -0
  132. package/sdk-core/crates/sdk-core/tests/activities_trybuild/no_return_type_pass.rs +19 -0
  133. package/sdk-core/crates/sdk-core/tests/cloud_tests.rs +14 -5
  134. package/sdk-core/crates/sdk-core/tests/common/activity_functions.rs +55 -0
  135. package/sdk-core/crates/sdk-core/tests/common/mod.rs +241 -196
  136. package/sdk-core/crates/sdk-core/tests/common/workflows.rs +41 -28
  137. package/sdk-core/crates/sdk-core/tests/global_metric_tests.rs +3 -5
  138. package/sdk-core/crates/sdk-core/tests/heavy_tests/fuzzy_workflow.rs +73 -64
  139. package/sdk-core/crates/sdk-core/tests/heavy_tests.rs +298 -252
  140. package/sdk-core/crates/sdk-core/tests/integ_tests/async_activity_client_tests.rs +230 -0
  141. package/sdk-core/crates/sdk-core/tests/integ_tests/client_tests.rs +94 -57
  142. package/sdk-core/crates/sdk-core/tests/integ_tests/data_converter_tests.rs +381 -0
  143. package/sdk-core/crates/sdk-core/tests/integ_tests/ephemeral_server_tests.rs +16 -12
  144. package/sdk-core/crates/sdk-core/tests/integ_tests/heartbeat_tests.rs +48 -40
  145. package/sdk-core/crates/sdk-core/tests/integ_tests/metrics_tests.rs +327 -255
  146. package/sdk-core/crates/sdk-core/tests/integ_tests/pagination_tests.rs +50 -45
  147. package/sdk-core/crates/sdk-core/tests/integ_tests/polling_tests.rs +147 -126
  148. package/sdk-core/crates/sdk-core/tests/integ_tests/queries_tests.rs +103 -89
  149. package/sdk-core/crates/sdk-core/tests/integ_tests/update_tests.rs +609 -453
  150. package/sdk-core/crates/sdk-core/tests/integ_tests/visibility_tests.rs +80 -62
  151. package/sdk-core/crates/sdk-core/tests/integ_tests/worker_heartbeat_tests.rs +360 -231
  152. package/sdk-core/crates/sdk-core/tests/integ_tests/worker_tests.rs +248 -185
  153. package/sdk-core/crates/sdk-core/tests/integ_tests/worker_versioning_tests.rs +52 -43
  154. package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_client_tests.rs +180 -0
  155. package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/activities.rs +428 -315
  156. package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/cancel_external.rs +82 -56
  157. package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/cancel_wf.rs +56 -28
  158. package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/child_workflows.rs +364 -243
  159. package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/client_interactions.rs +552 -0
  160. package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/continue_as_new.rs +101 -42
  161. package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/determinism.rs +243 -147
  162. package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/eager.rs +98 -28
  163. package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/local_activities.rs +1475 -1036
  164. package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/modify_wf_properties.rs +73 -41
  165. package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/nexus.rs +397 -238
  166. package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/patches.rs +414 -189
  167. package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/queries.rs +415 -0
  168. package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/replay.rs +96 -36
  169. package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/resets.rs +154 -137
  170. package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/signals.rs +183 -105
  171. package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/stickyness.rs +85 -38
  172. package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/timers.rs +142 -40
  173. package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/upsert_search_attrs.rs +73 -54
  174. package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests.rs +363 -226
  175. package/sdk-core/crates/sdk-core/tests/main.rs +17 -15
  176. package/sdk-core/crates/sdk-core/tests/manual_tests.rs +207 -152
  177. package/sdk-core/crates/sdk-core/tests/shared_tests/mod.rs +65 -34
  178. package/sdk-core/crates/sdk-core/tests/shared_tests/priority.rs +107 -84
  179. package/sdk-core/crates/sdk-core/tests/workflows_procmacro.rs +6 -0
  180. package/sdk-core/crates/sdk-core/tests/workflows_trybuild/async_query_fail.rs +26 -0
  181. package/sdk-core/crates/sdk-core/tests/workflows_trybuild/async_query_fail.stderr +5 -0
  182. package/sdk-core/crates/sdk-core/tests/workflows_trybuild/basic_pass.rs +49 -0
  183. package/sdk-core/crates/sdk-core/tests/workflows_trybuild/minimal_pass.rs +21 -0
  184. package/sdk-core/crates/sdk-core/tests/workflows_trybuild/mut_query_fail.rs +26 -0
  185. package/sdk-core/crates/sdk-core/tests/workflows_trybuild/mut_query_fail.stderr +5 -0
  186. package/sdk-core/crates/sdk-core/tests/workflows_trybuild/sync_run_fail.rs +21 -0
  187. package/sdk-core/crates/sdk-core/tests/workflows_trybuild/sync_run_fail.stderr +5 -0
  188. package/sdk-core/crates/sdk-core-c-bridge/Cargo.toml +7 -1
  189. package/sdk-core/crates/sdk-core-c-bridge/include/temporal-sdk-core-c-bridge.h +14 -14
  190. package/sdk-core/crates/sdk-core-c-bridge/src/client.rs +83 -74
  191. package/sdk-core/crates/sdk-core-c-bridge/src/metric.rs +9 -14
  192. package/sdk-core/crates/sdk-core-c-bridge/src/runtime.rs +1 -2
  193. package/sdk-core/crates/sdk-core-c-bridge/src/tests/context.rs +13 -13
  194. package/sdk-core/crates/sdk-core-c-bridge/src/tests/mod.rs +6 -6
  195. package/sdk-core/crates/sdk-core-c-bridge/src/tests/utils.rs +3 -4
  196. package/sdk-core/crates/sdk-core-c-bridge/src/worker.rs +62 -75
  197. package/sdk-core/rustfmt.toml +2 -1
  198. package/src/client.rs +205 -318
  199. package/src/metrics.rs +22 -30
  200. package/src/runtime.rs +4 -5
  201. package/src/worker.rs +16 -19
  202. package/ts/native.ts +1 -1
  203. package/sdk-core/crates/client/src/workflow_handle/mod.rs +0 -212
  204. package/sdk-core/crates/common/src/errors.rs +0 -85
  205. package/sdk-core/crates/common/tests/worker_task_types_test.rs +0 -129
  206. package/sdk-core/crates/sdk/src/activity_context.rs +0 -238
  207. package/sdk-core/crates/sdk/src/app_data.rs +0 -37
  208. package/sdk-core/crates/sdk-core/tests/integ_tests/activity_functions.rs +0 -5
  209. package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/appdata_propagation.rs +0 -61
@@ -5,15 +5,14 @@ use futures_util::{
5
5
  };
6
6
  use std::{
7
7
  fmt,
8
- sync::Arc,
9
8
  task::{Context, Poll},
10
9
  time::{Duration, Instant},
11
10
  };
12
11
  use temporalio_common::telemetry::{
13
12
  TaskQueueLabelStrategy,
14
13
  metrics::{
15
- CoreMeter, Counter, CounterBase, HistogramDuration, HistogramDurationBase,
16
- MetricAttributable, MetricAttributes, MetricKeyValue, MetricParameters, TemporalMeter,
14
+ Counter, CounterBase, HistogramDuration, HistogramDurationBase, MetricAttributable,
15
+ MetricAttributes, MetricKeyValue, MetricParameters, TemporalMeter,
17
16
  },
18
17
  };
19
18
  use tonic::{Code, body::Body, transport::Channel};
@@ -25,16 +24,12 @@ pub static REQUEST_LATENCY_HISTOGRAM_NAME: &str = "request_latency";
25
24
  pub static LONG_REQUEST_LATENCY_HISTOGRAM_NAME: &str = "long_request_latency";
26
25
 
27
26
  /// Used to track context associated with metrics, and record/update them
28
- // Possible improvement: make generic over some type tag so that methods are only exposed if the
29
- // appropriate k/vs have already been set.
30
27
  #[derive(Clone, derive_more::Debug)]
31
- #[debug("MetricsContext {{ attribs: {kvs:?}, poll_is_long: {poll_is_long} }}")]
28
+ #[debug("MetricsContext {{ poll_is_long: {poll_is_long} }}")]
32
29
  pub(crate) struct MetricsContext {
33
- meter: Arc<dyn CoreMeter>,
34
- kvs: MetricAttributes,
30
+ meter: TemporalMeter,
35
31
  poll_is_long: bool,
36
32
  instruments: Instruments,
37
- task_queue_label_strategy: TaskQueueLabelStrategy,
38
33
  }
39
34
  #[derive(Clone)]
40
35
  struct Instruments {
@@ -49,75 +44,70 @@ struct Instruments {
49
44
 
50
45
  impl MetricsContext {
51
46
  pub(crate) fn new(tm: TemporalMeter) -> Self {
52
- let meter = tm.inner;
53
- let task_queue_label_strategy = tm.task_queue_label_strategy;
54
- let kvs = meter.new_attributes(tm.default_attribs);
55
47
  let instruments = Instruments {
56
- svc_request: meter.counter(MetricParameters {
48
+ svc_request: tm.counter(MetricParameters {
57
49
  name: "request".into(),
58
50
  description: "Count of client request successes by rpc name".into(),
59
51
  unit: "".into(),
60
52
  }),
61
- svc_request_failed: meter.counter(MetricParameters {
53
+ svc_request_failed: tm.counter(MetricParameters {
62
54
  name: "request_failure".into(),
63
55
  description: "Count of client request failures by rpc name".into(),
64
56
  unit: "".into(),
65
57
  }),
66
- long_svc_request: meter.counter(MetricParameters {
58
+ long_svc_request: tm.counter(MetricParameters {
67
59
  name: "long_request".into(),
68
60
  description: "Count of long-poll request successes by rpc name".into(),
69
61
  unit: "".into(),
70
62
  }),
71
- long_svc_request_failed: meter.counter(MetricParameters {
63
+ long_svc_request_failed: tm.counter(MetricParameters {
72
64
  name: "long_request_failure".into(),
73
65
  description: "Count of long-poll request failures by rpc name".into(),
74
66
  unit: "".into(),
75
67
  }),
76
- svc_request_latency: meter.histogram_duration(MetricParameters {
68
+ svc_request_latency: tm.histogram_duration(MetricParameters {
77
69
  name: REQUEST_LATENCY_HISTOGRAM_NAME.into(),
78
70
  unit: "duration".into(),
79
71
  description: "Histogram of client request latencies".into(),
80
72
  }),
81
- long_svc_request_latency: meter.histogram_duration(MetricParameters {
73
+ long_svc_request_latency: tm.histogram_duration(MetricParameters {
82
74
  name: LONG_REQUEST_LATENCY_HISTOGRAM_NAME.into(),
83
75
  unit: "duration".into(),
84
76
  description: "Histogram of client long-poll request latencies".into(),
85
77
  }),
86
78
  };
87
79
  Self {
88
- kvs,
89
80
  poll_is_long: false,
90
81
  instruments,
91
- meter,
92
- task_queue_label_strategy,
82
+ meter: tm,
93
83
  }
94
84
  }
95
85
 
96
86
  /// Mutate this metrics context with new attributes
97
87
  pub(crate) fn with_new_attrs(&mut self, new_kvs: impl IntoIterator<Item = MetricKeyValue>) {
98
- self.kvs = self
99
- .meter
100
- .extend_attributes(self.kvs.clone(), new_kvs.into());
88
+ self.meter.merge_attributes(new_kvs.into());
101
89
 
102
90
  let _ = self
103
91
  .instruments
104
92
  .svc_request
105
- .with_attributes(&self.kvs)
93
+ .with_attributes(self.meter.get_default_attributes())
106
94
  .and_then(|v| {
107
95
  self.instruments.svc_request = v;
108
- self.instruments.long_svc_request.with_attributes(&self.kvs)
96
+ self.instruments
97
+ .long_svc_request
98
+ .with_attributes(self.meter.get_default_attributes())
109
99
  })
110
100
  .and_then(|v| {
111
101
  self.instruments.long_svc_request = v;
112
102
  self.instruments
113
103
  .svc_request_latency
114
- .with_attributes(&self.kvs)
104
+ .with_attributes(self.meter.get_default_attributes())
115
105
  })
116
106
  .and_then(|v| {
117
107
  self.instruments.svc_request_latency = v;
118
108
  self.instruments
119
109
  .long_svc_request_latency
120
- .with_attributes(&self.kvs)
110
+ .with_attributes(self.meter.get_default_attributes())
121
111
  })
122
112
  .map(|v| {
123
113
  self.instruments.long_svc_request_latency = v;
@@ -144,12 +134,13 @@ impl MetricsContext {
144
134
  pub(crate) fn svc_request_failed(&self, code: Option<Code>) {
145
135
  let refme: MetricAttributes;
146
136
  let kvs = if let Some(c) = code {
147
- refme = self
148
- .meter
149
- .extend_attributes(self.kvs.clone(), [status_code_kv(c)].into());
137
+ refme = self.meter.extend_attributes(
138
+ self.meter.get_default_attributes().clone(),
139
+ [status_code_kv(c)].into(),
140
+ );
150
141
  &refme
151
142
  } else {
152
- &self.kvs
143
+ self.meter.get_default_attributes()
153
144
  };
154
145
  if self.poll_is_long {
155
146
  self.instruments.long_svc_request_failed.add(1, kvs);
@@ -261,7 +252,7 @@ impl Service<http::Request<Body>> for GrpcMetricSvc {
261
252
  if other_labels.normal_task_queue.is_some()
262
253
  || other_labels.sticky_task_queue.is_some()
263
254
  {
264
- let task_queue_name = match m.task_queue_label_strategy {
255
+ let task_queue_name = match m.meter.get_task_queue_label_strategy() {
265
256
  TaskQueueLabelStrategy::UseNormal => other_labels.normal_task_queue,
266
257
  TaskQueueLabelStrategy::UseNormalAndSticky => other_labels
267
258
  .sticky_task_queue
@@ -0,0 +1,457 @@
1
+ use crate::{HttpConnectProxyOptions, RetryOptions, VERSION, callback_based};
2
+ use http::Uri;
3
+ use std::{collections::HashMap, time::Duration};
4
+ use temporalio_common::{
5
+ data_converters::DataConverter,
6
+ protos::temporal::api::{
7
+ common::{
8
+ self,
9
+ v1::{Header, Payload, Payloads},
10
+ },
11
+ enums::v1::{
12
+ ArchivalState, HistoryEventFilterType, QueryRejectCondition, WorkflowIdConflictPolicy,
13
+ WorkflowIdReusePolicy,
14
+ },
15
+ replication::v1::ClusterReplicationConfig,
16
+ workflowservice::v1::RegisterNamespaceRequest,
17
+ },
18
+ telemetry::metrics::TemporalMeter,
19
+ };
20
+ use url::Url;
21
+
22
+ /// Options for [crate::Connection::connect].
23
+ #[derive(bon::Builder, Clone, Debug)]
24
+ #[non_exhaustive]
25
+ #[builder(start_fn = new, on(String, into), state_mod(vis = "pub"))]
26
+ pub struct ConnectionOptions {
27
+ /// The server to connect to.
28
+ #[builder(start_fn, into)]
29
+ pub target: Url,
30
+ /// A human-readable string that can identify this process. Defaults to empty string.
31
+ #[builder(default)]
32
+ pub identity: String,
33
+ /// When set, this client will record metrics using the provided meter. The meter can be
34
+ /// obtained from [temporalio_common::telemetry::TelemetryInstance::get_temporal_metric_meter].
35
+ pub metrics_meter: Option<TemporalMeter>,
36
+ /// If specified, use TLS as configured by the [TlsOptions] struct. If this is set core will
37
+ /// attempt to use TLS when connecting to the Temporal server. Lang SDK is expected to pass any
38
+ /// certs or keys as bytes, loading them from disk itself if needed.
39
+ pub tls_options: Option<TlsOptions>,
40
+ /// If set, override the origin used when connecting. May be useful in rare situations where tls
41
+ /// verification needs to use a different name from what should be set as the `:authority`
42
+ /// header. If [TlsOptions::domain] is set, and this is not, this will be set to
43
+ /// `https://<domain>`, effectively making the `:authority` header consistent with the domain
44
+ /// override.
45
+ pub override_origin: Option<Uri>,
46
+ /// An API key to use for auth. If set, TLS will be enabled by default, but without any mTLS
47
+ /// specific settings.
48
+ pub api_key: Option<String>,
49
+ /// Retry configuration for the server client. Default is [RetryOptions::default]
50
+ #[builder(default)]
51
+ pub retry_options: RetryOptions,
52
+ /// If set, HTTP2 gRPC keep alive will be enabled.
53
+ /// To enable with default settings, use `.keep_alive(Some(ClientKeepAliveConfig::default()))`.
54
+ #[builder(required, default = Some(ClientKeepAliveOptions::default()))]
55
+ pub keep_alive: Option<ClientKeepAliveOptions>,
56
+ /// HTTP headers to include on every RPC call.
57
+ ///
58
+ /// These must be valid gRPC metadata keys, and must not be binary metadata keys (ending in
59
+ /// `-bin). To set binary headers, use [ConnectionOptions::binary_headers]. Invalid header keys
60
+ /// or values will cause an error to be returned when connecting.
61
+ pub headers: Option<HashMap<String, String>>,
62
+ /// HTTP headers to include on every RPC call as binary gRPC metadata (encoded as base64).
63
+ ///
64
+ /// These must be valid binary gRPC metadata keys (and end with a `-bin` suffix). Invalid
65
+ /// header keys will cause an error to be returned when connecting.
66
+ pub binary_headers: Option<HashMap<String, Vec<u8>>>,
67
+ /// HTTP CONNECT proxy to use for this client.
68
+ pub http_connect_proxy: Option<HttpConnectProxyOptions>,
69
+ /// If set true, error code labels will not be included on request failure metrics.
70
+ #[builder(default)]
71
+ pub disable_error_code_metric_tags: bool,
72
+ /// If set, all gRPC calls will be routed through the provided service.
73
+ pub service_override: Option<callback_based::CallbackBasedGrpcService>,
74
+
75
+ // Internal / Core-based SDK only options below =============================================
76
+ /// If set true, get_system_info will not be called upon connection.
77
+ #[builder(default)]
78
+ #[cfg_attr(feature = "core-based-sdk", builder(setters(vis = "pub")))]
79
+ pub(crate) skip_get_system_info: bool,
80
+ /// The name of the SDK being implemented on top of core. Is set as `client-name` header in
81
+ /// all RPC calls
82
+ #[builder(default = "temporal-rust".to_owned())]
83
+ #[cfg_attr(feature = "core-based-sdk", builder(setters(vis = "pub")))]
84
+ pub(crate) client_name: String,
85
+ // TODO [rust-sdk-branch]: SDK should set this to its version. Doing that probably easiest
86
+ // after adding proper client interceptors.
87
+ /// The version of the SDK being implemented on top of core. Is set as `client-version` header
88
+ /// in all RPC calls. The server decides if the client is supported based on this.
89
+ #[builder(default = VERSION.to_owned())]
90
+ #[cfg_attr(feature = "core-based-sdk", builder(setters(vis = "pub")))]
91
+ pub(crate) client_version: String,
92
+ }
93
+
94
+ // Setters/getters for fields that should only be touched by SDK implementers.
95
+ #[cfg(feature = "core-based-sdk")]
96
+ impl ConnectionOptions {
97
+ /// Set whether or not get_system_info will be called upon connection.
98
+ pub fn set_skip_get_system_info(&mut self, skip: bool) {
99
+ self.skip_get_system_info = skip;
100
+ }
101
+ /// Get whether or not get_system_info will be called upon connection.
102
+ pub fn get_skip_get_system_info(&self) -> bool {
103
+ self.skip_get_system_info
104
+ }
105
+ /// Get the name of the SDK being implemented on top of core.
106
+ pub fn get_client_name(&self) -> &str {
107
+ &self.client_name
108
+ }
109
+ /// Get the version of the SDK being implemented on top of core.
110
+ pub fn get_client_version(&self) -> &str {
111
+ &self.client_version
112
+ }
113
+ }
114
+
115
+ /// Options for [crate::Client::new].
116
+ #[derive(Clone, Debug, bon::Builder)]
117
+ #[non_exhaustive]
118
+ #[builder(start_fn = new, on(String, into), state_mod(vis = "pub"))]
119
+ pub struct ClientOptions {
120
+ /// The namespace this client will be bound to.
121
+ #[builder(start_fn)]
122
+ pub namespace: String,
123
+ /// The data converter used for serializing/deserializing payloads.
124
+ #[builder(default)]
125
+ pub data_converter: DataConverter,
126
+ }
127
+
128
+ /// Configuration options for TLS
129
+ #[derive(Clone, Debug, Default)]
130
+ pub struct TlsOptions {
131
+ /// Bytes representing the root CA certificate used by the server. If not set, and the server's
132
+ /// cert is issued by someone the operating system trusts, verification will still work (ex:
133
+ /// Cloud offering).
134
+ pub server_root_ca_cert: Option<Vec<u8>>,
135
+ /// Sets the domain name against which to verify the server's TLS certificate. If not provided,
136
+ /// the domain name will be extracted from the URL used to connect.
137
+ pub domain: Option<String>,
138
+ /// TLS info for the client. If specified, core will attempt to use mTLS.
139
+ pub client_tls_options: Option<ClientTlsOptions>,
140
+ }
141
+
142
+ /// If using mTLS, both the client cert and private key must be specified, this contains them.
143
+ #[derive(Clone)]
144
+ pub struct ClientTlsOptions {
145
+ /// The certificate for this client, encoded as PEM
146
+ pub client_cert: Vec<u8>,
147
+ /// The private key for this client, encoded as PEM
148
+ pub client_private_key: Vec<u8>,
149
+ }
150
+
151
+ /// Client keep alive configuration.
152
+ #[derive(Clone, Debug)]
153
+ pub struct ClientKeepAliveOptions {
154
+ /// Interval to send HTTP2 keep alive pings.
155
+ pub interval: Duration,
156
+ /// Timeout that the keep alive must be responded to within or the connection will be closed.
157
+ pub timeout: Duration,
158
+ }
159
+
160
+ impl Default for ClientKeepAliveOptions {
161
+ fn default() -> Self {
162
+ Self {
163
+ interval: Duration::from_secs(30),
164
+ timeout: Duration::from_secs(15),
165
+ }
166
+ }
167
+ }
168
+
169
+ impl std::fmt::Debug for ClientTlsOptions {
170
+ // Intentionally omit details here since they could leak a key if ever printed
171
+ fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
172
+ write!(f, "ClientTlsOptions(..)")
173
+ }
174
+ }
175
+
176
+ /// Options for starting a workflow execution.
177
+ #[derive(Debug, Clone, bon::Builder)]
178
+ #[builder(start_fn = new, on(String, into))]
179
+ #[non_exhaustive]
180
+ pub struct WorkflowStartOptions {
181
+ /// The task queue to run the workflow on.
182
+ #[builder(start_fn)]
183
+ pub task_queue: String,
184
+
185
+ /// The workflow ID.
186
+ #[builder(start_fn)]
187
+ pub workflow_id: String,
188
+
189
+ /// Set the policy for reusing the workflow id
190
+ #[builder(default)]
191
+ pub id_reuse_policy: WorkflowIdReusePolicy,
192
+
193
+ /// Set the policy for how to resolve conflicts with running policies.
194
+ /// NOTE: This is ignored for child workflows.
195
+ #[builder(default)]
196
+ pub id_conflict_policy: WorkflowIdConflictPolicy,
197
+
198
+ /// Optionally set the execution timeout for the workflow
199
+ /// <https://docs.temporal.io/workflows/#workflow-execution-timeout>
200
+ pub execution_timeout: Option<Duration>,
201
+
202
+ /// Optionally indicates the default run timeout for a workflow run
203
+ pub run_timeout: Option<Duration>,
204
+
205
+ /// Optionally indicates the default task timeout for a workflow run
206
+ pub task_timeout: Option<Duration>,
207
+
208
+ /// Optionally set a cron schedule for the workflow
209
+ pub cron_schedule: Option<String>,
210
+
211
+ /// Optionally associate extra search attributes with a workflow
212
+ pub search_attributes: Option<HashMap<String, Payload>>,
213
+
214
+ /// Optionally enable Eager Workflow Start, a latency optimization using local workers
215
+ /// NOTE: Experimental
216
+ #[builder(default)]
217
+ pub enable_eager_workflow_start: bool,
218
+
219
+ /// Optionally set a retry policy for the workflow
220
+ pub retry_policy: Option<common::v1::RetryPolicy>,
221
+
222
+ /// If set, send a signal to the workflow atomically with start.
223
+ /// The workflow will receive this signal before its first task.
224
+ pub start_signal: Option<WorkflowStartSignal>,
225
+
226
+ /// Links to associate with the workflow. Ex: References to a nexus operation.
227
+ #[builder(default)]
228
+ pub links: Vec<common::v1::Link>,
229
+
230
+ /// Callbacks that will be invoked upon workflow completion. For, ex, completing nexus
231
+ /// operations.
232
+ #[builder(default)]
233
+ pub completion_callbacks: Vec<common::v1::Callback>,
234
+
235
+ /// Priority for the workflow. Defaults to all-inherited (empty).
236
+ #[builder(default)]
237
+ pub priority: Priority,
238
+
239
+ /// Headers to include with the start request.
240
+ pub header: Option<Header>,
241
+ }
242
+
243
+ /// A signal to send atomically when starting a workflow.
244
+ /// Use with `WorkflowStartOptions::start_signal` to achieve signal-with-start behavior.
245
+ #[derive(Debug, Clone, bon::Builder)]
246
+ #[builder(start_fn = new, on(String, into))]
247
+ #[non_exhaustive]
248
+ pub struct WorkflowStartSignal {
249
+ /// Name of the signal to send.
250
+ #[builder(start_fn)]
251
+ pub signal_name: String,
252
+ /// Payload for the signal.
253
+ pub input: Option<Payloads>,
254
+ /// Headers for the signal.
255
+ pub header: Option<Header>,
256
+ }
257
+
258
+ pub use temporalio_common::Priority;
259
+
260
+ /// Options for fetching workflow results
261
+ #[derive(Debug, Clone, Copy, bon::Builder)]
262
+ #[non_exhaustive]
263
+ pub struct WorkflowGetResultOptions {
264
+ /// If true (the default), follows to the next workflow run in the execution chain while
265
+ /// retrieving results.
266
+ #[builder(default = true)]
267
+ pub follow_runs: bool,
268
+ }
269
+ impl Default for WorkflowGetResultOptions {
270
+ fn default() -> Self {
271
+ Self { follow_runs: true }
272
+ }
273
+ }
274
+
275
+ /// Options for starting a workflow update.
276
+ #[derive(Debug, Clone, Default, bon::Builder)]
277
+ #[non_exhaustive]
278
+ pub struct WorkflowExecuteUpdateOptions {
279
+ /// Update ID for idempotency.
280
+ pub update_id: Option<String>,
281
+ /// Headers to include.
282
+ pub header: Option<Header>,
283
+ }
284
+
285
+ /// Options for sending a signal to a workflow.
286
+ #[derive(Debug, Clone, Default, bon::Builder)]
287
+ #[non_exhaustive]
288
+ pub struct WorkflowSignalOptions {
289
+ /// Request ID for idempotency. If not provided, a UUID will be generated.
290
+ pub request_id: Option<String>,
291
+ /// Headers to include with the signal.
292
+ pub header: Option<Header>,
293
+ }
294
+
295
+ /// Options for querying a workflow.
296
+ #[derive(Debug, Clone, Default, bon::Builder)]
297
+ #[non_exhaustive]
298
+ pub struct WorkflowQueryOptions {
299
+ /// Query reject condition. Determines when the query should be rejected
300
+ /// based on workflow state.
301
+ pub reject_condition: Option<QueryRejectCondition>,
302
+ /// Headers to include with the query.
303
+ pub header: Option<Header>,
304
+ }
305
+
306
+ /// Options for cancelling a workflow.
307
+ #[derive(Debug, Clone, Default, bon::Builder)]
308
+ #[builder(on(String, into))]
309
+ #[non_exhaustive]
310
+ pub struct WorkflowCancelOptions {
311
+ /// Reason for cancellation.
312
+ #[builder(default)]
313
+ pub reason: String,
314
+ /// Request ID for idempotency. If not provided, a UUID will be generated.
315
+ pub request_id: Option<String>,
316
+ }
317
+
318
+ /// Options for terminating a workflow.
319
+ #[derive(Debug, Clone, Default, bon::Builder)]
320
+ #[builder(on(String, into))]
321
+ #[non_exhaustive]
322
+ pub struct WorkflowTerminateOptions {
323
+ /// Reason for termination.
324
+ #[builder(default)]
325
+ pub reason: String,
326
+ /// Additional details to include with the termination.
327
+ pub details: Option<Payloads>,
328
+ }
329
+
330
+ /// Options for describing a workflow.
331
+ #[derive(Debug, Clone, Default, bon::Builder)]
332
+ #[non_exhaustive]
333
+ pub struct WorkflowDescribeOptions {}
334
+
335
+ /// Default workflow execution retention for a Namespace is 3 days
336
+ const DEFAULT_WORKFLOW_EXECUTION_RETENTION_PERIOD: Duration = Duration::from_secs(60 * 60 * 24 * 3);
337
+
338
+ /// Helper struct for `register_namespace`.
339
+ #[derive(Clone, Debug, bon::Builder)]
340
+ #[builder(on(String, into))]
341
+ pub struct RegisterNamespaceOptions {
342
+ /// Name (required)
343
+ pub namespace: String,
344
+ /// Description (required)
345
+ pub description: String,
346
+ /// Owner's email
347
+ #[builder(default)]
348
+ pub owner_email: String,
349
+ /// Workflow execution retention period
350
+ #[builder(default = DEFAULT_WORKFLOW_EXECUTION_RETENTION_PERIOD)]
351
+ pub workflow_execution_retention_period: Duration,
352
+ /// Cluster settings
353
+ #[builder(default)]
354
+ pub clusters: Vec<ClusterReplicationConfig>,
355
+ /// Active cluster name
356
+ #[builder(default)]
357
+ pub active_cluster_name: String,
358
+ /// Custom Data
359
+ #[builder(default)]
360
+ pub data: HashMap<String, String>,
361
+ /// Security Token
362
+ #[builder(default)]
363
+ pub security_token: String,
364
+ /// Global namespace
365
+ #[builder(default)]
366
+ pub is_global_namespace: bool,
367
+ /// History Archival setting
368
+ #[builder(default = ArchivalState::Unspecified)]
369
+ pub history_archival_state: ArchivalState,
370
+ /// History Archival uri
371
+ #[builder(default)]
372
+ pub history_archival_uri: String,
373
+ /// Visibility Archival setting
374
+ #[builder(default = ArchivalState::Unspecified)]
375
+ pub visibility_archival_state: ArchivalState,
376
+ /// Visibility Archival uri
377
+ #[builder(default)]
378
+ pub visibility_archival_uri: String,
379
+ }
380
+
381
+ impl From<RegisterNamespaceOptions> for RegisterNamespaceRequest {
382
+ fn from(val: RegisterNamespaceOptions) -> Self {
383
+ RegisterNamespaceRequest {
384
+ namespace: val.namespace,
385
+ description: val.description,
386
+ owner_email: val.owner_email,
387
+ workflow_execution_retention_period: val
388
+ .workflow_execution_retention_period
389
+ .try_into()
390
+ .ok(),
391
+ clusters: val.clusters,
392
+ active_cluster_name: val.active_cluster_name,
393
+ data: val.data,
394
+ security_token: val.security_token,
395
+ is_global_namespace: val.is_global_namespace,
396
+ history_archival_state: val.history_archival_state as i32,
397
+ history_archival_uri: val.history_archival_uri,
398
+ visibility_archival_state: val.visibility_archival_state as i32,
399
+ visibility_archival_uri: val.visibility_archival_uri,
400
+ }
401
+ }
402
+ }
403
+
404
+ /// Options for fetching workflow history.
405
+ #[derive(Debug, Clone, Default, bon::Builder)]
406
+ #[non_exhaustive]
407
+ pub struct WorkflowFetchHistoryOptions {
408
+ /// Whether to skip archival.
409
+ #[builder(default)]
410
+ pub skip_archival: bool,
411
+ /// If set true, the fetch will wait for a new event before returning.
412
+ #[builder(default)]
413
+ pub wait_new_event: bool,
414
+ /// Specifies which kind of events will be retrieved. Defaults to all events.
415
+ #[builder(default = HistoryEventFilterType::AllEvent)]
416
+ pub event_filter_type: HistoryEventFilterType,
417
+ }
418
+
419
+ /// Which lifecycle stage to wait for when starting an update.
420
+ #[derive(Debug, Clone, Copy, Default, PartialEq, Eq)]
421
+ pub enum WorkflowUpdateWaitStage {
422
+ /// This stage is reached when the server receives the update to process.
423
+ /// This is currently an invalid value on start.
424
+ Admitted,
425
+ /// Wait until the update is accepted by the workflow (validator passed).
426
+ #[default]
427
+ Accepted,
428
+ /// Wait until the update has completed.
429
+ Completed,
430
+ }
431
+
432
+ /// Options for starting an update without waiting for completion.
433
+ #[derive(Debug, Clone, Default, bon::Builder)]
434
+ #[non_exhaustive]
435
+ pub struct WorkflowStartUpdateOptions {
436
+ /// Update ID for idempotency. If not provided, a UUID will be generated.
437
+ pub update_id: Option<String>,
438
+ /// Headers to include with the update.
439
+ pub header: Option<Header>,
440
+ /// The lifecycle stage to wait for before returning the handle.
441
+ #[builder(default)]
442
+ pub wait_for_stage: WorkflowUpdateWaitStage,
443
+ }
444
+
445
+ /// Options for listing workflows.
446
+ #[derive(Debug, Clone, Default, bon::Builder)]
447
+ #[non_exhaustive]
448
+ pub struct WorkflowListOptions {
449
+ /// Maximum number of workflows to return.
450
+ /// If not specified, returns all matching workflows.
451
+ pub limit: Option<usize>,
452
+ }
453
+
454
+ /// Options for counting workflows.
455
+ #[derive(Debug, Clone, Default, bon::Builder)]
456
+ #[non_exhaustive]
457
+ pub struct WorkflowCountOptions {}
@@ -20,8 +20,8 @@ where
20
20
  C: Clone + Send + Sync,
21
21
  {
22
22
  shared_data: Arc<SharedClientData<C>>,
23
- cloned_client: C,
24
- cloned_generation: u32,
23
+ pub(crate) cloned_client: C,
24
+ pub(crate) cloned_generation: u32,
25
25
  }
26
26
 
27
27
  #[derive(Debug)]
@@ -83,6 +83,7 @@ where
83
83
  }
84
84
 
85
85
  /// Returns a clone of the underlying client.
86
+ #[allow(dead_code)]
86
87
  pub fn inner_clone(&self) -> C {
87
88
  self.inner_cow().into_owned()
88
89
  }
@@ -105,7 +106,8 @@ where
105
106
  ///
106
107
  /// While this method allows mutable access to the underlying client, any configuration changes
107
108
  /// will not be shared with other instances, and will be lost if the client gets replaced from
108
- /// anywhere. To make configuration changes, use [`replace_client()`](Self::replace_client) instead.
109
+ /// anywhere. To make configuration changes, use [`replace_client()`](Self::replace_client)
110
+ /// instead.
109
111
  pub fn inner_mut_refreshed(&mut self) -> &mut C {
110
112
  if let Some((client, generation)) =
111
113
  self.shared_data.fetch_newer_than(self.cloned_generation)
@@ -152,7 +154,6 @@ where
152
154
  #[cfg(test)]
153
155
  mod tests {
154
156
  use super::*;
155
- use crate::NamespacedClient;
156
157
  use std::borrow::Cow;
157
158
 
158
159
  #[derive(Debug, Clone)]
@@ -1,27 +1,26 @@
1
1
  //! Request extensions for tonic gRPC requests.
2
2
  //!
3
- //! These types can be inserted into tonic request extensions to modify behavior of the
4
- //! [RetryClient](crate::RetryClient) or other request handling logic.
3
+ //! These types can be inserted into tonic request extensions to modify behavior of retires or other
4
+ //! request handling logic.
5
5
 
6
6
  use crate::RetryOptions;
7
7
  use std::time::Duration;
8
8
 
9
- /// A request extension that, when set, should make the [RetryClient](crate::RetryClient) consider
10
- /// this call to be a [CallType::TaskLongPoll](crate::CallType::TaskLongPoll)
9
+ /// A request extension that, when set, should make the retry behavior consider this call to be a
10
+ /// [CallType::TaskLongPoll](crate::CallType::TaskLongPoll)
11
11
  #[derive(Copy, Clone, Debug)]
12
12
  pub struct IsWorkerTaskLongPoll;
13
13
 
14
- /// A request extension that, when set, and a call is being processed by a
15
- /// [RetryClient](crate::RetryClient), allows the caller to request certain matching errors to
16
- /// short-circuit-return immediately and not follow normal retry logic.
14
+ /// A request extension that, when set, and a call is being processed by a retrying client, allows
15
+ /// the caller to request certain matching errors to short-circuit-return immediately and not follow
16
+ /// normal retry logic.
17
17
  #[derive(Copy, Clone, Debug)]
18
18
  pub struct NoRetryOnMatching {
19
19
  /// Return true if the passed-in gRPC error should be immediately returned to the caller
20
20
  pub predicate: fn(&tonic::Status) -> bool,
21
21
  }
22
22
 
23
- /// A request extension that forces overriding the current retry policy of the
24
- /// [RetryClient](crate::RetryClient).
23
+ /// A request extension that forces overriding the current retry policy of the [crate::Connection].
25
24
  #[derive(Clone, Debug)]
26
25
  pub struct RetryConfigForCall(pub RetryOptions);
27
26