Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e521e20

Browse files
authored
Fix clients being created without prefixed metric meter (temporalio#1441)
1 parent fdb708f commit e521e20

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

packages/core-bridge/src/runtime.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ use tokio::sync::{
2222
};
2323
use tokio_stream::wrappers::ReceiverStream;
2424

25-
pub type RawClient = RetryClient<ConfiguredClient<TemporalServiceClientWithMetrics>>;
25+
pub type CoreClient = RetryClient<ConfiguredClient<TemporalServiceClientWithMetrics>>;
2626

2727
#[derive(Clone)]
2828
pub struct EphemeralServer {
@@ -43,7 +43,7 @@ impl Finalize for RuntimeHandle {}
4343
#[derive(Clone)]
4444
pub struct Client {
4545
pub(crate) runtime: Arc<RuntimeHandle>,
46-
pub(crate) core_client: Arc<RawClient>,
46+
pub(crate) core_client: Arc<CoreClient>,
4747
}
4848

4949
pub type BoxedClient = JsBox<RefCell<Option<Client>>>;
@@ -65,7 +65,7 @@ pub enum RuntimeRequest {
6565
},
6666
/// A request to update a client's HTTP request headers
6767
UpdateClientHeaders {
68-
client: Arc<RawClient>,
68+
client: Arc<CoreClient>,
6969
headers: HashMap<String, String>,
7070
/// Used to send the result back into JS
7171
callback: Root<JsFunction>,
@@ -75,7 +75,7 @@ pub enum RuntimeRequest {
7575
/// Worker configuration e.g. limits and task queue
7676
config: WorkerConfig,
7777
/// A client created with a [CreateClient] request
78-
client: Arc<RawClient>,
78+
client: Arc<CoreClient>,
7979
/// Used to send the result back into JS
8080
callback: Root<JsFunction>,
8181
},
@@ -107,7 +107,7 @@ pub enum RuntimeRequest {
107107
callback: Root<JsFunction>,
108108
},
109109
UpdateClientApiKey {
110-
client: Arc<RawClient>,
110+
client: Arc<CoreClient>,
111111
key: String,
112112
callback: Root<JsFunction>,
113113
},
@@ -168,7 +168,7 @@ pub fn start_bridge_loop(
168168
options,
169169
callback,
170170
} => {
171-
let mm = core_runtime.telemetry().get_metric_meter();
171+
let mm = core_runtime.telemetry().get_temporal_metric_meter();
172172
core_runtime.tokio_handle().spawn(async move {
173173
match options
174174
.connect_no_namespace(mm)
@@ -248,7 +248,7 @@ pub fn start_bridge_loop(
248248
callback,
249249
} => {
250250
let client = (*client).clone();
251-
match init_worker(&core_runtime, config, client.into_inner()) {
251+
match init_worker(&core_runtime, config, client) {
252252
Ok(worker) => {
253253
let (tx, rx) = unbounded_channel();
254254
core_runtime.tokio_handle().spawn(start_worker_loop(

packages/test/src/test-prometheus.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,8 @@ test.serial('Exporting Prometheus metrics from Core works with lots of options',
105105
);
106106
// Verify 'total' suffix
107107
t.assert(text.includes('temporal_worker_start_total'));
108+
// Verify prefix exists on client request metrics
109+
t.assert(text.includes('temporal_long_request'));
108110
});
109111
} finally {
110112
await localEnv.teardown();

0 commit comments

Comments
 (0)