Skip to content

Commit 58ab3c3

Browse files
pzhan9meta-codesync[bot]
authored andcommitted
Use hypractor::instrument instead of tracing::instrument (#2021)
Summary: Pull Request resolved: #2021 The project uses `hypractor::instrument` mostly. We want to migrate remainly `tracing::instrument` to it so we can enforce a consistent behavior. Reviewed By: shayne-fletcher Differential Revision: D88077441 fbshipit-source-id: 5721f4cfbb5f2048d5eae13c98316e7bafa528ee
1 parent 52b6be4 commit 58ab3c3

File tree

5 files changed

+9
-8
lines changed

5 files changed

+9
-8
lines changed

hyperactor/src/host.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ use tokio::process::Child;
5555
use tokio::process::Command;
5656
use tokio::sync::Mutex;
5757

58+
use crate as hyperactor;
5859
use crate::Actor;
5960
use crate::ActorHandle;
6061
use crate::ActorId;
@@ -133,7 +134,7 @@ impl<M: ProcManager> Host<M> {
133134
/// Serve a host using the provided ProcManager, on the provided `addr`.
134135
/// On success, the host will multiplex messages for procs on the host
135136
/// on the address of the host.
136-
#[tracing::instrument(skip(manager))]
137+
#[crate::instrument(fields(addr=addr.to_string()))]
137138
pub async fn new(manager: M, addr: ChannelAddr) -> Result<Self, HostError> {
138139
let (frontend_addr, frontend_rx) = channel::serve(addr)?;
139140

@@ -870,7 +871,7 @@ where
870871
ChannelTransport::Local
871872
}
872873

873-
#[tracing::instrument(skip(self, _config))]
874+
#[crate::instrument(fields(proc_id=proc_id.to_string(), addr=forwarder_addr.to_string()))]
874875
async fn spawn(
875876
&self,
876877
proc_id: ProcId,
@@ -1048,7 +1049,7 @@ where
10481049
ChannelTransport::Unix
10491050
}
10501051

1051-
#[tracing::instrument(skip(self, _config))]
1052+
#[crate::instrument(fields(proc_id=proc_id.to_string(), addr=forwarder_addr.to_string()))]
10521053
async fn spawn(
10531054
&self,
10541055
proc_id: ProcId,
@@ -1142,7 +1143,7 @@ where
11421143
/// forwarding messages to the provided `backend_addr`,
11431144
/// and returning the proc's address and agent actor on
11441145
/// the provided `callback_addr`.
1145-
#[tracing::instrument(skip(spawn))]
1146+
#[crate::instrument(fields(proc_id=proc_id.to_string(), addr=backend_addr.to_string(), callback_addr=callback_addr.to_string()))]
11461147
pub async fn spawn_proc<A, S, F>(
11471148
proc_id: ProcId,
11481149
backend_addr: ChannelAddr,

hyperactor_mesh/src/alloc/remoteprocess.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ impl RemoteProcessAllocator {
174174
/// Start a remote process allocator with given allocator listening for
175175
/// RemoteProcessAllocatorMessage on serve_addr.
176176
/// Used for testing.
177-
#[tracing::instrument(skip(self, process_allocator))]
177+
#[hyperactor::instrument(fields(addr=serve_addr.to_string()))]
178178
pub async fn start_with_allocator<A: Allocator + Send + Sync + 'static>(
179179
&self,
180180
serve_addr: ChannelAddr,

hyperactor_mesh/src/bootstrap.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1848,7 +1848,7 @@ impl ProcManager for BootstrapProcManager {
18481848
/// Returns a [`BootstrapProcHandle`] that exposes the child
18491849
/// process's lifecycle (status, wait/ready, termination). Errors
18501850
/// are surfaced as [`HostError`].
1851-
#[tracing::instrument(skip(self, config))]
1851+
#[hyperactor::instrument(fields(proc_id=proc_id.to_string(), addr=backend_addr.to_string()))]
18521852
async fn spawn(
18531853
&self,
18541854
proc_id: ProcId,

hyperactor_mesh/src/proc_mesh.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ impl ProcMesh {
274274
C.get_or_init(|| AtomicUsize::new(0))
275275
}
276276

277-
#[tracing::instrument(skip_all)]
277+
#[hyperactor::instrument]
278278
#[hyperactor::observe_result("ProcMesh")]
279279
async fn allocate_boxed_inner(
280280
mut alloc: Box<dyn Alloc + Send + Sync>,

hyperactor_mesh/src/router.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ impl Router {
5757
/// Servers are memoized, and we maintain only one per transport; thus
5858
/// subsequent calls using the same transport will return the same address.
5959
#[allow(dead_code)]
60-
#[tracing::instrument(skip(self))]
60+
#[hyperactor::instrument]
6161
pub async fn serve(&self, transport: &ChannelTransport) -> Result<ChannelAddr, ChannelError> {
6262
let mut servers = self.servers.lock().await;
6363
if let Some(addr) = servers.get(transport) {

0 commit comments

Comments
 (0)