@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.
- package/Cargo.lock +172 -70
- package/lib/native.d.ts +1 -1
- package/package.json +2 -2
- 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/.github/workflows/per-pr.yml +6 -6
- package/sdk-core/AGENTS.md +41 -30
- package/sdk-core/Cargo.toml +3 -0
- package/sdk-core/README.md +15 -9
- package/sdk-core/crates/client/Cargo.toml +4 -0
- package/sdk-core/crates/client/README.md +139 -0
- package/sdk-core/crates/client/src/async_activity_handle.rs +297 -0
- package/sdk-core/crates/client/src/callback_based.rs +7 -0
- package/sdk-core/crates/client/src/errors.rs +294 -0
- package/sdk-core/crates/client/src/{raw.rs → grpc.rs} +280 -159
- package/sdk-core/crates/client/src/lib.rs +920 -1326
- package/sdk-core/crates/client/src/metrics.rs +24 -33
- package/sdk-core/crates/client/src/options_structs.rs +457 -0
- package/sdk-core/crates/client/src/replaceable.rs +5 -4
- package/sdk-core/crates/client/src/request_extensions.rs +8 -9
- package/sdk-core/crates/client/src/retry.rs +99 -54
- package/sdk-core/crates/client/src/{worker/mod.rs → worker.rs} +1 -1
- package/sdk-core/crates/client/src/workflow_handle.rs +826 -0
- package/sdk-core/crates/common/Cargo.toml +61 -2
- package/sdk-core/crates/common/build.rs +742 -12
- package/sdk-core/crates/common/protos/api_upstream/.github/workflows/ci.yml +2 -0
- package/sdk-core/crates/common/protos/api_upstream/Makefile +2 -1
- package/sdk-core/crates/common/protos/api_upstream/buf.yaml +0 -3
- package/sdk-core/crates/common/protos/api_upstream/cmd/check-path-conflicts/main.go +137 -0
- package/sdk-core/crates/common/protos/api_upstream/openapi/openapiv2.json +1166 -770
- package/sdk-core/crates/common/protos/api_upstream/openapi/openapiv3.yaml +1243 -750
- package/sdk-core/crates/common/protos/api_upstream/temporal/api/deployment/v1/message.proto +2 -2
- package/sdk-core/crates/common/protos/api_upstream/temporal/api/enums/v1/workflow.proto +4 -3
- package/sdk-core/crates/common/protos/api_upstream/temporal/api/failure/v1/message.proto +1 -0
- package/sdk-core/crates/common/protos/api_upstream/temporal/api/history/v1/message.proto +4 -0
- package/sdk-core/crates/common/protos/api_upstream/temporal/api/namespace/v1/message.proto +6 -0
- package/sdk-core/crates/common/protos/api_upstream/temporal/api/nexus/v1/message.proto +16 -1
- package/sdk-core/crates/common/protos/api_upstream/temporal/api/workflowservice/v1/request_response.proto +64 -6
- package/sdk-core/crates/common/protos/api_upstream/temporal/api/workflowservice/v1/service.proto +88 -33
- package/sdk-core/crates/common/protos/local/temporal/sdk/core/nexus/nexus.proto +4 -2
- package/sdk-core/crates/common/protos/local/temporal/sdk/core/workflow_activation/workflow_activation.proto +4 -0
- package/sdk-core/crates/common/protos/local/temporal/sdk/core/workflow_commands/workflow_commands.proto +5 -5
- package/sdk-core/crates/common/src/activity_definition.rs +20 -0
- package/sdk-core/crates/common/src/data_converters.rs +770 -0
- package/sdk-core/crates/common/src/envconfig.rs +5 -0
- package/sdk-core/crates/common/src/lib.rs +15 -211
- package/sdk-core/crates/common/src/payload_visitor.rs +648 -0
- package/sdk-core/crates/common/src/priority.rs +110 -0
- package/sdk-core/crates/common/src/protos/canned_histories.rs +3 -0
- package/sdk-core/crates/common/src/protos/history_builder.rs +45 -0
- package/sdk-core/crates/common/src/protos/history_info.rs +2 -0
- package/sdk-core/crates/common/src/protos/mod.rs +122 -27
- package/sdk-core/crates/common/src/protos/task_token.rs +3 -3
- package/sdk-core/crates/common/src/protos/utilities.rs +11 -0
- package/sdk-core/crates/{sdk-core → common}/src/telemetry/log_export.rs +5 -7
- package/sdk-core/crates/common/src/telemetry/metrics/core.rs +125 -0
- package/sdk-core/crates/common/src/telemetry/metrics.rs +268 -223
- package/sdk-core/crates/{sdk-core → common}/src/telemetry/otel.rs +8 -13
- package/sdk-core/crates/{sdk-core → common}/src/telemetry/prometheus_meter.rs +49 -50
- package/sdk-core/crates/{sdk-core → common}/src/telemetry/prometheus_server.rs +2 -3
- package/sdk-core/crates/common/src/telemetry.rs +264 -4
- package/sdk-core/crates/common/src/worker.rs +68 -603
- package/sdk-core/crates/common/src/workflow_definition.rs +60 -0
- package/sdk-core/crates/macros/Cargo.toml +5 -1
- package/sdk-core/crates/macros/src/activities_definitions.rs +585 -0
- package/sdk-core/crates/macros/src/fsm_impl.rs +507 -0
- package/sdk-core/crates/macros/src/lib.rs +138 -512
- package/sdk-core/crates/macros/src/macro_utils.rs +106 -0
- package/sdk-core/crates/macros/src/workflow_definitions.rs +1224 -0
- package/sdk-core/crates/sdk/Cargo.toml +19 -6
- package/sdk-core/crates/sdk/README.md +415 -0
- package/sdk-core/crates/sdk/src/activities.rs +417 -0
- package/sdk-core/crates/sdk/src/interceptors.rs +1 -1
- package/sdk-core/crates/sdk/src/lib.rs +757 -442
- package/sdk-core/crates/sdk/src/workflow_context/options.rs +45 -35
- package/sdk-core/crates/sdk/src/workflow_context.rs +1033 -289
- package/sdk-core/crates/sdk/src/workflow_future.rs +277 -213
- package/sdk-core/crates/sdk/src/workflows.rs +711 -0
- package/sdk-core/crates/sdk-core/Cargo.toml +57 -64
- package/sdk-core/crates/sdk-core/benches/workflow_replay_bench.rs +41 -35
- package/sdk-core/crates/sdk-core/machine_coverage/ActivityMachine_Coverage.puml +1 -1
- package/sdk-core/crates/sdk-core/src/abstractions.rs +6 -10
- package/sdk-core/crates/sdk-core/src/core_tests/activity_tasks.rs +6 -5
- package/sdk-core/crates/sdk-core/src/core_tests/mod.rs +13 -15
- package/sdk-core/crates/sdk-core/src/core_tests/queries.rs +21 -25
- package/sdk-core/crates/sdk-core/src/core_tests/replay_flag.rs +7 -10
- package/sdk-core/crates/sdk-core/src/core_tests/updates.rs +14 -17
- package/sdk-core/crates/sdk-core/src/core_tests/workers.rs +493 -26
- package/sdk-core/crates/sdk-core/src/core_tests/workflow_tasks.rs +4 -8
- package/sdk-core/crates/sdk-core/src/ephemeral_server/mod.rs +7 -7
- package/sdk-core/crates/sdk-core/src/histfetch.rs +20 -10
- package/sdk-core/crates/sdk-core/src/lib.rs +41 -111
- package/sdk-core/crates/sdk-core/src/pollers/mod.rs +4 -9
- package/sdk-core/crates/sdk-core/src/pollers/poll_buffer.rs +118 -19
- package/sdk-core/crates/sdk-core/src/protosext/mod.rs +2 -2
- package/sdk-core/crates/sdk-core/src/replay/mod.rs +14 -5
- package/sdk-core/crates/sdk-core/src/telemetry/metrics.rs +179 -196
- package/sdk-core/crates/sdk-core/src/telemetry/mod.rs +3 -280
- package/sdk-core/crates/sdk-core/src/test_help/integ_helpers.rs +6 -9
- package/sdk-core/crates/sdk-core/src/test_help/unit_helpers.rs +3 -6
- package/sdk-core/crates/sdk-core/src/worker/activities/local_activities.rs +11 -14
- package/sdk-core/crates/sdk-core/src/worker/activities.rs +16 -19
- package/sdk-core/crates/sdk-core/src/worker/client/mocks.rs +9 -5
- package/sdk-core/crates/sdk-core/src/worker/client.rs +103 -81
- package/sdk-core/crates/sdk-core/src/worker/heartbeat.rs +7 -11
- package/sdk-core/crates/sdk-core/src/worker/mod.rs +1124 -229
- package/sdk-core/crates/sdk-core/src/worker/nexus.rs +145 -23
- package/sdk-core/crates/sdk-core/src/worker/slot_provider.rs +2 -2
- package/sdk-core/crates/sdk-core/src/worker/tuner/fixed_size.rs +2 -2
- package/sdk-core/crates/sdk-core/src/worker/tuner/resource_based.rs +13 -13
- package/sdk-core/crates/sdk-core/src/worker/tuner.rs +28 -8
- package/sdk-core/crates/sdk-core/src/worker/workflow/driven_workflow.rs +9 -3
- package/sdk-core/crates/sdk-core/src/worker/workflow/machines/upsert_search_attributes_state_machine.rs +21 -22
- package/sdk-core/crates/sdk-core/src/worker/workflow/machines/workflow_machines.rs +19 -4
- package/sdk-core/crates/sdk-core/src/worker/workflow/managed_run.rs +14 -18
- package/sdk-core/crates/sdk-core/src/worker/workflow/mod.rs +4 -6
- package/sdk-core/crates/sdk-core/src/worker/workflow/run_cache.rs +4 -7
- package/sdk-core/crates/sdk-core/src/worker/workflow/wft_extraction.rs +2 -4
- package/sdk-core/crates/sdk-core/src/worker/workflow/wft_poller.rs +8 -9
- package/sdk-core/crates/sdk-core/src/worker/workflow/workflow_stream.rs +1 -3
- package/sdk-core/crates/sdk-core/tests/activities_procmacro.rs +6 -0
- package/sdk-core/crates/sdk-core/tests/activities_trybuild/basic_pass.rs +54 -0
- package/sdk-core/crates/sdk-core/tests/activities_trybuild/invalid_self_type_fail.rs +18 -0
- package/sdk-core/crates/sdk-core/tests/activities_trybuild/invalid_self_type_fail.stderr +5 -0
- package/sdk-core/crates/sdk-core/tests/activities_trybuild/missing_context_fail.rs +14 -0
- package/sdk-core/crates/sdk-core/tests/activities_trybuild/missing_context_fail.stderr +5 -0
- package/sdk-core/crates/sdk-core/tests/activities_trybuild/multi_arg_pass.rs +48 -0
- package/sdk-core/crates/sdk-core/tests/activities_trybuild/no_input_pass.rs +14 -0
- package/sdk-core/crates/sdk-core/tests/activities_trybuild/no_return_type_pass.rs +19 -0
- package/sdk-core/crates/sdk-core/tests/cloud_tests.rs +14 -5
- package/sdk-core/crates/sdk-core/tests/common/activity_functions.rs +55 -0
- package/sdk-core/crates/sdk-core/tests/common/mod.rs +241 -196
- package/sdk-core/crates/sdk-core/tests/common/workflows.rs +41 -28
- package/sdk-core/crates/sdk-core/tests/global_metric_tests.rs +3 -5
- package/sdk-core/crates/sdk-core/tests/heavy_tests/fuzzy_workflow.rs +73 -64
- package/sdk-core/crates/sdk-core/tests/heavy_tests.rs +298 -252
- package/sdk-core/crates/sdk-core/tests/integ_tests/async_activity_client_tests.rs +230 -0
- package/sdk-core/crates/sdk-core/tests/integ_tests/client_tests.rs +94 -57
- package/sdk-core/crates/sdk-core/tests/integ_tests/data_converter_tests.rs +381 -0
- package/sdk-core/crates/sdk-core/tests/integ_tests/ephemeral_server_tests.rs +16 -12
- package/sdk-core/crates/sdk-core/tests/integ_tests/heartbeat_tests.rs +48 -40
- package/sdk-core/crates/sdk-core/tests/integ_tests/metrics_tests.rs +327 -255
- package/sdk-core/crates/sdk-core/tests/integ_tests/pagination_tests.rs +50 -45
- package/sdk-core/crates/sdk-core/tests/integ_tests/polling_tests.rs +147 -126
- package/sdk-core/crates/sdk-core/tests/integ_tests/queries_tests.rs +103 -89
- package/sdk-core/crates/sdk-core/tests/integ_tests/update_tests.rs +609 -453
- package/sdk-core/crates/sdk-core/tests/integ_tests/visibility_tests.rs +80 -62
- package/sdk-core/crates/sdk-core/tests/integ_tests/worker_heartbeat_tests.rs +360 -231
- package/sdk-core/crates/sdk-core/tests/integ_tests/worker_tests.rs +248 -185
- package/sdk-core/crates/sdk-core/tests/integ_tests/worker_versioning_tests.rs +52 -43
- package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_client_tests.rs +180 -0
- package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/activities.rs +428 -315
- package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/cancel_external.rs +82 -56
- package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/cancel_wf.rs +56 -28
- package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/child_workflows.rs +364 -243
- package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/client_interactions.rs +552 -0
- package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/continue_as_new.rs +101 -42
- package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/determinism.rs +243 -147
- package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/eager.rs +98 -28
- package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/local_activities.rs +1475 -1036
- package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/modify_wf_properties.rs +73 -41
- package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/nexus.rs +397 -238
- package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/patches.rs +414 -189
- package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/queries.rs +415 -0
- package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/replay.rs +96 -36
- package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/resets.rs +154 -137
- package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/signals.rs +183 -105
- package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/stickyness.rs +85 -38
- package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/timers.rs +142 -40
- package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/upsert_search_attrs.rs +73 -54
- package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests.rs +363 -226
- package/sdk-core/crates/sdk-core/tests/main.rs +17 -15
- package/sdk-core/crates/sdk-core/tests/manual_tests.rs +207 -152
- package/sdk-core/crates/sdk-core/tests/shared_tests/mod.rs +65 -34
- package/sdk-core/crates/sdk-core/tests/shared_tests/priority.rs +107 -84
- package/sdk-core/crates/sdk-core/tests/workflows_procmacro.rs +6 -0
- package/sdk-core/crates/sdk-core/tests/workflows_trybuild/async_query_fail.rs +26 -0
- package/sdk-core/crates/sdk-core/tests/workflows_trybuild/async_query_fail.stderr +5 -0
- package/sdk-core/crates/sdk-core/tests/workflows_trybuild/basic_pass.rs +49 -0
- package/sdk-core/crates/sdk-core/tests/workflows_trybuild/minimal_pass.rs +21 -0
- package/sdk-core/crates/sdk-core/tests/workflows_trybuild/mut_query_fail.rs +26 -0
- package/sdk-core/crates/sdk-core/tests/workflows_trybuild/mut_query_fail.stderr +5 -0
- package/sdk-core/crates/sdk-core/tests/workflows_trybuild/sync_run_fail.rs +21 -0
- package/sdk-core/crates/sdk-core/tests/workflows_trybuild/sync_run_fail.stderr +5 -0
- package/sdk-core/crates/sdk-core-c-bridge/Cargo.toml +7 -1
- package/sdk-core/crates/sdk-core-c-bridge/include/temporal-sdk-core-c-bridge.h +14 -14
- package/sdk-core/crates/sdk-core-c-bridge/src/client.rs +83 -74
- package/sdk-core/crates/sdk-core-c-bridge/src/metric.rs +9 -14
- package/sdk-core/crates/sdk-core-c-bridge/src/runtime.rs +1 -2
- package/sdk-core/crates/sdk-core-c-bridge/src/tests/context.rs +13 -13
- package/sdk-core/crates/sdk-core-c-bridge/src/tests/mod.rs +6 -6
- package/sdk-core/crates/sdk-core-c-bridge/src/tests/utils.rs +3 -4
- package/sdk-core/crates/sdk-core-c-bridge/src/worker.rs +62 -75
- package/sdk-core/rustfmt.toml +2 -1
- package/src/client.rs +205 -318
- package/src/metrics.rs +22 -30
- package/src/runtime.rs +4 -5
- package/src/worker.rs +16 -19
- package/ts/native.ts +1 -1
- package/sdk-core/crates/client/src/workflow_handle/mod.rs +0 -212
- package/sdk-core/crates/common/src/errors.rs +0 -85
- package/sdk-core/crates/common/tests/worker_task_types_test.rs +0 -129
- package/sdk-core/crates/sdk/src/activity_context.rs +0 -238
- package/sdk-core/crates/sdk/src/app_data.rs +0 -37
- package/sdk-core/crates/sdk-core/tests/integ_tests/activity_functions.rs +0 -5
- package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/appdata_propagation.rs +0 -61
|
@@ -3,27 +3,26 @@ use crate::TelemetryInstance;
|
|
|
3
3
|
use crate::abstractions::dbg_panic;
|
|
4
4
|
|
|
5
5
|
use std::{
|
|
6
|
+
collections::HashMap,
|
|
6
7
|
fmt::{Debug, Display},
|
|
7
8
|
iter::Iterator,
|
|
8
|
-
sync::Arc,
|
|
9
|
+
sync::{Arc, atomic::AtomicU64},
|
|
9
10
|
time::Duration,
|
|
10
11
|
};
|
|
11
12
|
use temporalio_common::{
|
|
12
13
|
protos::temporal::api::{enums::v1::WorkflowTaskFailedCause, failure::v1::Failure},
|
|
13
|
-
telemetry::metrics::{
|
|
14
|
-
BufferAttributes, BufferInstrumentRef, CoreMeter, Counter, CounterBase, Gauge, GaugeBase,
|
|
15
|
-
GaugeF64, GaugeF64Base, Histogram, HistogramBase, HistogramDuration, HistogramDurationBase,
|
|
16
|
-
HistogramF64, HistogramF64Base, LazyBufferInstrument, MetricAttributable, MetricAttributes,
|
|
17
|
-
MetricCallBufferer, MetricEvent, MetricKeyValue, MetricKind, MetricParameters,
|
|
18
|
-
MetricUpdateVal, NewAttributes, NoOpCoreMeter, TemporalMeter, WorkerHeartbeatMetrics,
|
|
19
|
-
},
|
|
14
|
+
telemetry::metrics::{core::*, *},
|
|
20
15
|
};
|
|
21
16
|
|
|
17
|
+
pub(super) const NUM_POLLERS_NAME: &str = "num_pollers";
|
|
18
|
+
pub(super) const TASK_SLOTS_AVAILABLE_NAME: &str = "worker_task_slots_available";
|
|
19
|
+
pub(super) const TASK_SLOTS_USED_NAME: &str = "worker_task_slots_used";
|
|
20
|
+
pub(super) const STICKY_CACHE_SIZE_NAME: &str = "sticky_cache_size";
|
|
21
|
+
|
|
22
22
|
/// Used to track context associated with metrics, and record/update them
|
|
23
23
|
#[derive(Clone)]
|
|
24
24
|
pub(crate) struct MetricsContext {
|
|
25
|
-
meter:
|
|
26
|
-
kvs: MetricAttributes,
|
|
25
|
+
meter: TemporalMeter,
|
|
27
26
|
instruments: Arc<Instruments>,
|
|
28
27
|
in_memory_metrics: Option<Arc<WorkerHeartbeatMetrics>>,
|
|
29
28
|
}
|
|
@@ -69,12 +68,10 @@ struct Instruments {
|
|
|
69
68
|
|
|
70
69
|
impl MetricsContext {
|
|
71
70
|
pub(crate) fn no_op() -> Self {
|
|
72
|
-
let meter =
|
|
73
|
-
let kvs = meter.new_attributes(Default::default());
|
|
71
|
+
let meter = TemporalMeter::no_op();
|
|
74
72
|
let in_memory_metrics = Some(Arc::new(WorkerHeartbeatMetrics::default()));
|
|
75
|
-
let instruments = Arc::new(Instruments::new(meter
|
|
73
|
+
let instruments = Arc::new(Instruments::new(&meter, in_memory_metrics.clone()));
|
|
76
74
|
Self {
|
|
77
|
-
kvs,
|
|
78
75
|
instruments,
|
|
79
76
|
meter,
|
|
80
77
|
in_memory_metrics,
|
|
@@ -92,19 +89,17 @@ impl MetricsContext {
|
|
|
92
89
|
temporal_meter: Option<TemporalMeter>,
|
|
93
90
|
) -> Self {
|
|
94
91
|
if let Some(mut meter) = temporal_meter {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
meter.
|
|
100
|
-
let kvs = meter.inner.new_attributes(meter.default_attribs);
|
|
92
|
+
let addtl_attributes = [
|
|
93
|
+
MetricKeyValue::new(KEY_NAMESPACE, namespace),
|
|
94
|
+
task_queue(tq),
|
|
95
|
+
];
|
|
96
|
+
meter.merge_attributes(addtl_attributes.into());
|
|
101
97
|
let in_memory_metrics = Some(Arc::new(WorkerHeartbeatMetrics::default()));
|
|
102
|
-
let mut instruments = Instruments::new(meter
|
|
103
|
-
instruments.update_attributes(
|
|
98
|
+
let mut instruments = Instruments::new(&meter, in_memory_metrics.clone());
|
|
99
|
+
instruments.update_attributes(meter.get_default_attributes());
|
|
104
100
|
Self {
|
|
105
|
-
kvs,
|
|
106
101
|
instruments: Arc::new(instruments),
|
|
107
|
-
meter
|
|
102
|
+
meter,
|
|
108
103
|
in_memory_metrics,
|
|
109
104
|
}
|
|
110
105
|
} else {
|
|
@@ -117,14 +112,12 @@ impl MetricsContext {
|
|
|
117
112
|
&self,
|
|
118
113
|
new_attrs: impl IntoIterator<Item = MetricKeyValue>,
|
|
119
114
|
) -> Self {
|
|
120
|
-
let
|
|
121
|
-
|
|
122
|
-
.extend_attributes(self.kvs.clone(), new_attrs.into());
|
|
115
|
+
let mut tm = self.meter.clone();
|
|
116
|
+
tm.merge_attributes(new_attrs.into());
|
|
123
117
|
let mut instruments = (*self.instruments).clone();
|
|
124
|
-
instruments.update_attributes(
|
|
118
|
+
instruments.update_attributes(tm.get_default_attributes());
|
|
125
119
|
Self {
|
|
126
120
|
instruments: Arc::new(instruments),
|
|
127
|
-
kvs,
|
|
128
121
|
meter: self.meter.clone(),
|
|
129
122
|
in_memory_metrics: self.in_memory_metrics.clone(),
|
|
130
123
|
}
|
|
@@ -309,7 +302,7 @@ impl MetricsContext {
|
|
|
309
302
|
}
|
|
310
303
|
|
|
311
304
|
impl Instruments {
|
|
312
|
-
fn new(meter: &
|
|
305
|
+
fn new(meter: &TemporalMeter, in_memory: Option<Arc<WorkerHeartbeatMetrics>>) -> Self {
|
|
313
306
|
let counter_with_in_mem = |params: MetricParameters| -> Counter {
|
|
314
307
|
in_memory
|
|
315
308
|
.clone()
|
|
@@ -591,6 +584,129 @@ impl Instruments {
|
|
|
591
584
|
}
|
|
592
585
|
}
|
|
593
586
|
|
|
587
|
+
#[derive(Default, Debug)]
|
|
588
|
+
pub(crate) struct NumPollersMetric {
|
|
589
|
+
pub wft_current_pollers: Arc<AtomicU64>,
|
|
590
|
+
pub sticky_wft_current_pollers: Arc<AtomicU64>,
|
|
591
|
+
pub activity_current_pollers: Arc<AtomicU64>,
|
|
592
|
+
pub nexus_current_pollers: Arc<AtomicU64>,
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
impl NumPollersMetric {
|
|
596
|
+
pub(crate) fn as_map(&self) -> HashMap<String, Arc<AtomicU64>> {
|
|
597
|
+
HashMap::from([
|
|
598
|
+
(
|
|
599
|
+
"workflow_task".to_string(),
|
|
600
|
+
self.wft_current_pollers.clone(),
|
|
601
|
+
),
|
|
602
|
+
(
|
|
603
|
+
"sticky_workflow_task".to_string(),
|
|
604
|
+
self.sticky_wft_current_pollers.clone(),
|
|
605
|
+
),
|
|
606
|
+
(
|
|
607
|
+
"activity_task".to_string(),
|
|
608
|
+
self.activity_current_pollers.clone(),
|
|
609
|
+
),
|
|
610
|
+
("nexus_task".to_string(), self.nexus_current_pollers.clone()),
|
|
611
|
+
])
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
#[derive(Default, Debug)]
|
|
616
|
+
pub(crate) struct SlotMetrics {
|
|
617
|
+
pub workflow_worker: Arc<AtomicU64>,
|
|
618
|
+
pub activity_worker: Arc<AtomicU64>,
|
|
619
|
+
pub nexus_worker: Arc<AtomicU64>,
|
|
620
|
+
pub local_activity_worker: Arc<AtomicU64>,
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
impl SlotMetrics {
|
|
624
|
+
pub(crate) fn as_map(&self) -> HashMap<String, Arc<AtomicU64>> {
|
|
625
|
+
HashMap::from([
|
|
626
|
+
("WorkflowWorker".to_string(), self.workflow_worker.clone()),
|
|
627
|
+
("ActivityWorker".to_string(), self.activity_worker.clone()),
|
|
628
|
+
("NexusWorker".to_string(), self.nexus_worker.clone()),
|
|
629
|
+
(
|
|
630
|
+
"LocalActivityWorker".to_string(),
|
|
631
|
+
self.local_activity_worker.clone(),
|
|
632
|
+
),
|
|
633
|
+
])
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
#[derive(Default, Debug)]
|
|
638
|
+
pub(crate) struct WorkerHeartbeatMetrics {
|
|
639
|
+
pub sticky_cache_size: Arc<AtomicU64>,
|
|
640
|
+
pub total_sticky_cache_hit: Arc<AtomicU64>,
|
|
641
|
+
pub total_sticky_cache_miss: Arc<AtomicU64>,
|
|
642
|
+
pub num_pollers: NumPollersMetric,
|
|
643
|
+
pub worker_task_slots_used: SlotMetrics,
|
|
644
|
+
pub worker_task_slots_available: SlotMetrics,
|
|
645
|
+
pub workflow_task_execution_failed: Arc<AtomicU64>,
|
|
646
|
+
pub activity_execution_failed: Arc<AtomicU64>,
|
|
647
|
+
pub nexus_task_execution_failed: Arc<AtomicU64>,
|
|
648
|
+
pub local_activity_execution_failed: Arc<AtomicU64>,
|
|
649
|
+
// Although latency metrics here are histograms, we are using the number of times they're called
|
|
650
|
+
// to represent the `total_processed_tasks` heartbeat field
|
|
651
|
+
pub activity_execution_latency: Arc<AtomicU64>,
|
|
652
|
+
pub local_activity_execution_latency: Arc<AtomicU64>,
|
|
653
|
+
pub workflow_task_execution_latency: Arc<AtomicU64>,
|
|
654
|
+
pub nexus_task_execution_latency: Arc<AtomicU64>,
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
impl WorkerHeartbeatMetrics {
|
|
658
|
+
pub(crate) fn get_metric(&self, name: &str) -> Option<HeartbeatMetricType> {
|
|
659
|
+
match name {
|
|
660
|
+
"sticky_cache_size" => Some(HeartbeatMetricType::Individual(
|
|
661
|
+
self.sticky_cache_size.clone(),
|
|
662
|
+
)),
|
|
663
|
+
"sticky_cache_hit" => Some(HeartbeatMetricType::Individual(
|
|
664
|
+
self.total_sticky_cache_hit.clone(),
|
|
665
|
+
)),
|
|
666
|
+
"sticky_cache_miss" => Some(HeartbeatMetricType::Individual(
|
|
667
|
+
self.total_sticky_cache_miss.clone(),
|
|
668
|
+
)),
|
|
669
|
+
"num_pollers" => Some(HeartbeatMetricType::WithLabel {
|
|
670
|
+
label_key: "poller_type".to_string(),
|
|
671
|
+
metrics: self.num_pollers.as_map(),
|
|
672
|
+
}),
|
|
673
|
+
"worker_task_slots_used" => Some(HeartbeatMetricType::WithLabel {
|
|
674
|
+
label_key: "worker_type".to_string(),
|
|
675
|
+
metrics: self.worker_task_slots_used.as_map(),
|
|
676
|
+
}),
|
|
677
|
+
"worker_task_slots_available" => Some(HeartbeatMetricType::WithLabel {
|
|
678
|
+
label_key: "worker_type".to_string(),
|
|
679
|
+
metrics: self.worker_task_slots_available.as_map(),
|
|
680
|
+
}),
|
|
681
|
+
"workflow_task_execution_failed" => Some(HeartbeatMetricType::Individual(
|
|
682
|
+
self.workflow_task_execution_failed.clone(),
|
|
683
|
+
)),
|
|
684
|
+
"activity_execution_failed" => Some(HeartbeatMetricType::Individual(
|
|
685
|
+
self.activity_execution_failed.clone(),
|
|
686
|
+
)),
|
|
687
|
+
"nexus_task_execution_failed" => Some(HeartbeatMetricType::Individual(
|
|
688
|
+
self.nexus_task_execution_failed.clone(),
|
|
689
|
+
)),
|
|
690
|
+
"local_activity_execution_failed" => Some(HeartbeatMetricType::Individual(
|
|
691
|
+
self.local_activity_execution_failed.clone(),
|
|
692
|
+
)),
|
|
693
|
+
"activity_execution_latency" => Some(HeartbeatMetricType::Individual(
|
|
694
|
+
self.activity_execution_latency.clone(),
|
|
695
|
+
)),
|
|
696
|
+
"local_activity_execution_latency" => Some(HeartbeatMetricType::Individual(
|
|
697
|
+
self.local_activity_execution_latency.clone(),
|
|
698
|
+
)),
|
|
699
|
+
"workflow_task_execution_latency" => Some(HeartbeatMetricType::Individual(
|
|
700
|
+
self.workflow_task_execution_latency.clone(),
|
|
701
|
+
)),
|
|
702
|
+
"nexus_task_execution_latency" => Some(HeartbeatMetricType::Individual(
|
|
703
|
+
self.nexus_task_execution_latency.clone(),
|
|
704
|
+
)),
|
|
705
|
+
_ => None,
|
|
706
|
+
}
|
|
707
|
+
}
|
|
708
|
+
}
|
|
709
|
+
|
|
594
710
|
const KEY_NAMESPACE: &str = "namespace";
|
|
595
711
|
const KEY_WF_TYPE: &str = "workflow_type";
|
|
596
712
|
const KEY_TASK_QUEUE: &str = "task_queue";
|
|
@@ -669,25 +785,6 @@ pub(crate) fn failure_reason(reason: FailureReason) -> MetricKeyValue {
|
|
|
669
785
|
MetricKeyValue::new(KEY_TASK_FAILURE_TYPE, reason.to_string())
|
|
670
786
|
}
|
|
671
787
|
|
|
672
|
-
/// The string name (which may be prefixed) for this metric
|
|
673
|
-
pub const WORKFLOW_E2E_LATENCY_HISTOGRAM_NAME: &str = "workflow_endtoend_latency";
|
|
674
|
-
/// The string name (which may be prefixed) for this metric
|
|
675
|
-
pub const WORKFLOW_TASK_SCHED_TO_START_LATENCY_HISTOGRAM_NAME: &str =
|
|
676
|
-
"workflow_task_schedule_to_start_latency";
|
|
677
|
-
/// The string name (which may be prefixed) for this metric
|
|
678
|
-
pub const WORKFLOW_TASK_REPLAY_LATENCY_HISTOGRAM_NAME: &str = "workflow_task_replay_latency";
|
|
679
|
-
/// The string name (which may be prefixed) for this metric
|
|
680
|
-
pub const WORKFLOW_TASK_EXECUTION_LATENCY_HISTOGRAM_NAME: &str = "workflow_task_execution_latency";
|
|
681
|
-
/// The string name (which may be prefixed) for this metric
|
|
682
|
-
pub const ACTIVITY_SCHED_TO_START_LATENCY_HISTOGRAM_NAME: &str =
|
|
683
|
-
"activity_schedule_to_start_latency";
|
|
684
|
-
/// The string name (which may be prefixed) for this metric
|
|
685
|
-
pub const ACTIVITY_EXEC_LATENCY_HISTOGRAM_NAME: &str = "activity_execution_latency";
|
|
686
|
-
pub(super) const NUM_POLLERS_NAME: &str = "num_pollers";
|
|
687
|
-
pub(super) const TASK_SLOTS_AVAILABLE_NAME: &str = "worker_task_slots_available";
|
|
688
|
-
pub(super) const TASK_SLOTS_USED_NAME: &str = "worker_task_slots_used";
|
|
689
|
-
pub(super) const STICKY_CACHE_SIZE_NAME: &str = "sticky_cache_size";
|
|
690
|
-
|
|
691
788
|
/// Track a failure metric if the failure is not a benign application failure.
|
|
692
789
|
pub(crate) fn should_record_failure_metric(failure: &Option<Failure>) -> bool {
|
|
693
790
|
!failure
|
|
@@ -695,81 +792,6 @@ pub(crate) fn should_record_failure_metric(failure: &Option<Failure>) -> bool {
|
|
|
695
792
|
.is_some_and(|f| f.is_benign_application_failure())
|
|
696
793
|
}
|
|
697
794
|
|
|
698
|
-
/// Helps define buckets once in terms of millis, but also generates a seconds version
|
|
699
|
-
macro_rules! define_latency_buckets {
|
|
700
|
-
($(($metric_name:pat, $name:ident, $sec_name:ident, [$($bucket:expr),*])),*) => {
|
|
701
|
-
$(
|
|
702
|
-
pub(super) static $name: &[f64] = &[$($bucket,)*];
|
|
703
|
-
pub(super) static $sec_name: &[f64] = &[$( $bucket / 1000.0, )*];
|
|
704
|
-
)*
|
|
705
|
-
|
|
706
|
-
/// Returns the default histogram buckets that lang should use for a given metric name if
|
|
707
|
-
/// they have not been overridden by the user. If `use_seconds` is true, returns buckets
|
|
708
|
-
/// in terms of seconds rather than milliseconds.
|
|
709
|
-
///
|
|
710
|
-
/// The name must *not* be prefixed with `temporal_`
|
|
711
|
-
pub fn default_buckets_for(histo_name: &str, use_seconds: bool) -> &'static [f64] {
|
|
712
|
-
match histo_name {
|
|
713
|
-
$(
|
|
714
|
-
$metric_name => { if use_seconds { &$sec_name } else { &$name } },
|
|
715
|
-
)*
|
|
716
|
-
}
|
|
717
|
-
}
|
|
718
|
-
};
|
|
719
|
-
}
|
|
720
|
-
|
|
721
|
-
define_latency_buckets!(
|
|
722
|
-
(
|
|
723
|
-
WORKFLOW_E2E_LATENCY_HISTOGRAM_NAME,
|
|
724
|
-
WF_LATENCY_MS_BUCKETS,
|
|
725
|
-
WF_LATENCY_S_BUCKETS,
|
|
726
|
-
[
|
|
727
|
-
100.,
|
|
728
|
-
500.,
|
|
729
|
-
1000.,
|
|
730
|
-
1500.,
|
|
731
|
-
2000.,
|
|
732
|
-
5000.,
|
|
733
|
-
10_000.,
|
|
734
|
-
30_000.,
|
|
735
|
-
60_000.,
|
|
736
|
-
120_000.,
|
|
737
|
-
300_000.,
|
|
738
|
-
600_000.,
|
|
739
|
-
1_800_000., // 30 min
|
|
740
|
-
3_600_000., // 1 hr
|
|
741
|
-
30_600_000., // 10 hrs
|
|
742
|
-
8.64e7 // 24 hrs
|
|
743
|
-
]
|
|
744
|
-
),
|
|
745
|
-
(
|
|
746
|
-
WORKFLOW_TASK_EXECUTION_LATENCY_HISTOGRAM_NAME
|
|
747
|
-
| WORKFLOW_TASK_REPLAY_LATENCY_HISTOGRAM_NAME,
|
|
748
|
-
WF_TASK_MS_BUCKETS,
|
|
749
|
-
WF_TASK_S_BUCKETS,
|
|
750
|
-
[1., 10., 20., 50., 100., 200., 500., 1000.]
|
|
751
|
-
),
|
|
752
|
-
(
|
|
753
|
-
ACTIVITY_EXEC_LATENCY_HISTOGRAM_NAME,
|
|
754
|
-
ACT_EXE_MS_BUCKETS,
|
|
755
|
-
ACT_EXE_S_BUCKETS,
|
|
756
|
-
[50., 100., 500., 1000., 5000., 10_000., 60_000.]
|
|
757
|
-
),
|
|
758
|
-
(
|
|
759
|
-
WORKFLOW_TASK_SCHED_TO_START_LATENCY_HISTOGRAM_NAME
|
|
760
|
-
| ACTIVITY_SCHED_TO_START_LATENCY_HISTOGRAM_NAME,
|
|
761
|
-
TASK_SCHED_TO_START_MS_BUCKETS,
|
|
762
|
-
TASK_SCHED_TO_START_S_BUCKETS,
|
|
763
|
-
[100., 500., 1000., 5000., 10_000., 100_000., 1_000_000.]
|
|
764
|
-
),
|
|
765
|
-
(
|
|
766
|
-
_,
|
|
767
|
-
DEFAULT_MS_BUCKETS,
|
|
768
|
-
DEFAULT_S_BUCKETS,
|
|
769
|
-
[50., 100., 500., 1000., 2500., 10_000.]
|
|
770
|
-
)
|
|
771
|
-
);
|
|
772
|
-
|
|
773
795
|
/// Buffers [MetricEvent]s for periodic consumption by lang
|
|
774
796
|
#[derive(Debug)]
|
|
775
797
|
pub struct MetricsCallBuffer<I>
|
|
@@ -900,7 +922,10 @@ where
|
|
|
900
922
|
fn send(&self, value: MetricUpdateVal, attributes: &MetricAttributes) {
|
|
901
923
|
let attributes = match attributes {
|
|
902
924
|
MetricAttributes::Buffer(l) => l.clone(),
|
|
903
|
-
|
|
925
|
+
e => panic!(
|
|
926
|
+
"MetricsCallBuffer only works with MetricAttributes::Buffer, but used: {:?}",
|
|
927
|
+
e
|
|
928
|
+
),
|
|
904
929
|
};
|
|
905
930
|
self.tx.send(MetricEvent::Update {
|
|
906
931
|
instrument: self.instrument_ref.clone(),
|
|
@@ -1060,64 +1085,15 @@ where
|
|
|
1060
1085
|
}
|
|
1061
1086
|
}
|
|
1062
1087
|
|
|
1063
|
-
#[derive(Debug, derive_more::Constructor)]
|
|
1064
|
-
pub(crate) struct PrefixedMetricsMeter<CM> {
|
|
1065
|
-
prefix: String,
|
|
1066
|
-
meter: CM,
|
|
1067
|
-
}
|
|
1068
|
-
impl<CM: CoreMeter> CoreMeter for PrefixedMetricsMeter<CM> {
|
|
1069
|
-
fn new_attributes(&self, attribs: NewAttributes) -> MetricAttributes {
|
|
1070
|
-
self.meter.new_attributes(attribs)
|
|
1071
|
-
}
|
|
1072
|
-
|
|
1073
|
-
fn extend_attributes(
|
|
1074
|
-
&self,
|
|
1075
|
-
existing: MetricAttributes,
|
|
1076
|
-
attribs: NewAttributes,
|
|
1077
|
-
) -> MetricAttributes {
|
|
1078
|
-
self.meter.extend_attributes(existing, attribs)
|
|
1079
|
-
}
|
|
1080
|
-
|
|
1081
|
-
fn counter(&self, mut params: MetricParameters) -> Counter {
|
|
1082
|
-
params.name = (self.prefix.clone() + &*params.name).into();
|
|
1083
|
-
self.meter.counter(params)
|
|
1084
|
-
}
|
|
1085
|
-
|
|
1086
|
-
fn histogram(&self, mut params: MetricParameters) -> Histogram {
|
|
1087
|
-
params.name = (self.prefix.clone() + &*params.name).into();
|
|
1088
|
-
self.meter.histogram(params)
|
|
1089
|
-
}
|
|
1090
|
-
|
|
1091
|
-
fn histogram_f64(&self, mut params: MetricParameters) -> HistogramF64 {
|
|
1092
|
-
params.name = (self.prefix.clone() + &*params.name).into();
|
|
1093
|
-
self.meter.histogram_f64(params)
|
|
1094
|
-
}
|
|
1095
|
-
|
|
1096
|
-
fn histogram_duration(&self, mut params: MetricParameters) -> HistogramDuration {
|
|
1097
|
-
params.name = (self.prefix.clone() + &*params.name).into();
|
|
1098
|
-
self.meter.histogram_duration(params)
|
|
1099
|
-
}
|
|
1100
|
-
|
|
1101
|
-
fn gauge(&self, mut params: MetricParameters) -> Gauge {
|
|
1102
|
-
params.name = (self.prefix.clone() + &*params.name).into();
|
|
1103
|
-
self.meter.gauge(params)
|
|
1104
|
-
}
|
|
1105
|
-
|
|
1106
|
-
fn gauge_f64(&self, mut params: MetricParameters) -> GaugeF64 {
|
|
1107
|
-
params.name = (self.prefix.clone() + &*params.name).into();
|
|
1108
|
-
self.meter.gauge_f64(params)
|
|
1109
|
-
}
|
|
1110
|
-
}
|
|
1111
|
-
|
|
1112
1088
|
#[cfg(test)]
|
|
1113
1089
|
mod tests {
|
|
1114
1090
|
use super::*;
|
|
1115
1091
|
use std::any::Any;
|
|
1116
1092
|
use temporalio_common::telemetry::{
|
|
1117
|
-
|
|
1118
|
-
metrics::{BufferInstrumentRef, CustomMetricAttributes},
|
|
1093
|
+
TelemetryOptions,
|
|
1094
|
+
metrics::core::{BufferInstrumentRef, CustomMetricAttributes},
|
|
1095
|
+
telemetry_init,
|
|
1119
1096
|
};
|
|
1120
|
-
use tracing::subscriber::NoSubscriber;
|
|
1121
1097
|
|
|
1122
1098
|
#[derive(Debug)]
|
|
1123
1099
|
struct DummyCustomAttrs(usize);
|
|
@@ -1144,16 +1120,13 @@ mod tests {
|
|
|
1144
1120
|
|
|
1145
1121
|
#[test]
|
|
1146
1122
|
fn test_buffered_core_context() {
|
|
1147
|
-
let no_op_subscriber = Arc::new(NoSubscriber::new());
|
|
1148
1123
|
let call_buffer = Arc::new(MetricsCallBuffer::new(100));
|
|
1149
|
-
let telem_instance =
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
temporalio_common::telemetry::TaskQueueLabelStrategy::UseNormal,
|
|
1156
|
-
);
|
|
1124
|
+
let telem_instance = telemetry_init(
|
|
1125
|
+
TelemetryOptions::builder()
|
|
1126
|
+
.metrics(call_buffer.clone() as Arc<dyn CoreMeter>)
|
|
1127
|
+
.build(),
|
|
1128
|
+
)
|
|
1129
|
+
.unwrap();
|
|
1157
1130
|
let mc = MetricsContext::top_level("foo".to_string(), "q".to_string(), &telem_instance);
|
|
1158
1131
|
mc.forced_cache_eviction();
|
|
1159
1132
|
let events = call_buffer.retrieve();
|
|
@@ -1164,17 +1137,27 @@ mod tests {
|
|
|
1164
1137
|
append_from: None,
|
|
1165
1138
|
attributes,
|
|
1166
1139
|
}
|
|
1167
|
-
if attributes[0].key == "service_name"
|
|
1168
|
-
|
|
1169
|
-
|
|
1140
|
+
if attributes[0].key == "service_name"
|
|
1141
|
+
=> populate_into
|
|
1142
|
+
);
|
|
1143
|
+
let a2 = assert_matches!(
|
|
1144
|
+
&events[1],
|
|
1145
|
+
MetricEvent::CreateAttributes {
|
|
1146
|
+
populate_into,
|
|
1147
|
+
append_from: Some(_),
|
|
1148
|
+
attributes,
|
|
1149
|
+
}
|
|
1150
|
+
if attributes[0].key == "namespace" &&
|
|
1151
|
+
attributes[1].key == "task_queue"
|
|
1170
1152
|
=> populate_into
|
|
1171
1153
|
);
|
|
1172
1154
|
a1.set(Arc::new(DummyCustomAttrs(1))).unwrap();
|
|
1155
|
+
a2.set(Arc::new(DummyCustomAttrs(2))).unwrap();
|
|
1173
1156
|
// Verify all metrics are created. This number will need to get updated any time a metric
|
|
1174
1157
|
// is added.
|
|
1175
1158
|
let num_metrics = 35;
|
|
1176
1159
|
#[allow(clippy::needless_range_loop)] // Sorry clippy, this reads easier.
|
|
1177
|
-
for metric_num in
|
|
1160
|
+
for metric_num in 2..=num_metrics + 1 {
|
|
1178
1161
|
let hole = assert_matches!(&events[metric_num],
|
|
1179
1162
|
MetricEvent::Create { populate_into, .. }
|
|
1180
1163
|
=> populate_into
|
|
@@ -1182,18 +1165,19 @@ mod tests {
|
|
|
1182
1165
|
hole.set(Arc::new(DummyInstrumentRef(metric_num))).unwrap();
|
|
1183
1166
|
}
|
|
1184
1167
|
assert_matches!(
|
|
1185
|
-
&events[num_metrics +
|
|
1168
|
+
&events[num_metrics + 2], // +2 for attrib creation (at start), then this update
|
|
1186
1169
|
MetricEvent::Update {
|
|
1187
1170
|
instrument,
|
|
1188
1171
|
attributes,
|
|
1189
1172
|
update: MetricUpdateVal::Delta(1)
|
|
1190
1173
|
}
|
|
1191
|
-
if DummyCustomAttrs::as_id(attributes) ==
|
|
1174
|
+
if DummyCustomAttrs::as_id(attributes) == 2 && instrument.get().0 == num_metrics + 1
|
|
1192
1175
|
);
|
|
1193
1176
|
// Verify creating a new context with new attributes merges them properly
|
|
1194
1177
|
let mc2 = mc.with_new_attrs([MetricKeyValue::new("gotta", "go fast")]);
|
|
1195
1178
|
mc2.wf_task_latency(Duration::from_secs(1));
|
|
1196
1179
|
let events = call_buffer.retrieve();
|
|
1180
|
+
dbg!(&events);
|
|
1197
1181
|
let a2 = assert_matches!(
|
|
1198
1182
|
&events[0],
|
|
1199
1183
|
MetricEvent::CreateAttributes {
|
|
@@ -1201,11 +1185,10 @@ mod tests {
|
|
|
1201
1185
|
append_from: Some(eh),
|
|
1202
1186
|
attributes
|
|
1203
1187
|
}
|
|
1204
|
-
if attributes[0].key == "gotta" && DummyCustomAttrs::as_id(eh) ==
|
|
1188
|
+
if attributes[0].key == "gotta" && DummyCustomAttrs::as_id(eh) == 2
|
|
1205
1189
|
=> populate_into
|
|
1206
1190
|
);
|
|
1207
|
-
a2.set(Arc::new(DummyCustomAttrs(
|
|
1208
|
-
dbg!(&events);
|
|
1191
|
+
a2.set(Arc::new(DummyCustomAttrs(3))).unwrap();
|
|
1209
1192
|
assert_matches!(
|
|
1210
1193
|
&events[1],
|
|
1211
1194
|
MetricEvent::Update {
|
|
@@ -1213,7 +1196,7 @@ mod tests {
|
|
|
1213
1196
|
attributes,
|
|
1214
1197
|
update: MetricUpdateVal::Duration(d)
|
|
1215
1198
|
}
|
|
1216
|
-
if DummyCustomAttrs::as_id(attributes) ==
|
|
1199
|
+
if DummyCustomAttrs::as_id(attributes) == 3 && instrument.get().0 == 12
|
|
1217
1200
|
&& d == &Duration::from_secs(1)
|
|
1218
1201
|
);
|
|
1219
1202
|
}
|