From 1b4a71eecfa6bb9f9964e58051498d6b7aeee890 Mon Sep 17 00:00:00 2001 From: Adam Perry Date: Thu, 9 Jul 2026 01:41:04 +0000 Subject: [PATCH] exec-server: centralize client RPC spans --- codex-rs/exec-server/src/rpc.rs | 41 +++++++++++---------------------- 1 file changed, 13 insertions(+), 28 deletions(-) diff --git a/codex-rs/exec-server/src/rpc.rs b/codex-rs/exec-server/src/rpc.rs index 72483f22c0..fdb5466c7b 100644 --- a/codex-rs/exec-server/src/rpc.rs +++ b/codex-rs/exec-server/src/rpc.rs @@ -367,19 +367,6 @@ impl RpcClient { RequestId::Integer(self.next_request_id.fetch_add(1, Ordering::SeqCst)) } - #[tracing::instrument( - name = "codex.exec_server.request", - level = "info", - skip_all, - fields( - otel.kind = "client", - otel.name = method, - rpc.system = "jsonrpc", - rpc.method = method, - rpc.request_id = tracing::field::Empty, - method, - ) - )] pub(crate) async fn call(&self, method: &str, params: &P) -> Result where P: Serialize, @@ -387,7 +374,6 @@ impl RpcClient { { let _call_slot = self.acquire_regular_call_slot()?; let request_id = self.allocate_request_id(); - tracing::Span::current().record("rpc.request_id", tracing::field::display(&request_id)); self.call_inner(request_id, method, params, RpcCallTimeout::None) .await } @@ -413,19 +399,6 @@ impl RpcClient { .await } - #[tracing::instrument( - name = "codex.exec_server.request", - level = "info", - skip_all, - fields( - otel.kind = "client", - otel.name = method, - rpc.system = "jsonrpc", - rpc.method = method, - rpc.request_id = tracing::field::Empty, - method, - ) - )] pub(crate) async fn call_for_cleanup( &self, method: &str, @@ -446,11 +419,23 @@ impl RpcClient { }, }; let request_id = self.allocate_request_id(); - tracing::Span::current().record("rpc.request_id", tracing::field::display(&request_id)); self.call_inner(request_id, method, params, RpcCallTimeout::None) .await } + #[tracing::instrument( + name = "codex.exec_server.request", + level = "info", + skip_all, + fields( + otel.kind = "client", + otel.name = method, + rpc.system = "jsonrpc", + rpc.method = method, + rpc.request_id = %request_id, + method, + ) + )] async fn call_inner( &self, request_id: RequestId,