Skip to content

Commit f85c6be

Browse files
chore(host): interpolate tracing logs for provider restarts
Signed-off-by: Brooks Townsend <brooksmtownsend@gmail.com>
1 parent c5d0f25 commit f85c6be

File tree

1 file changed

+25
-13
lines changed
  • crates/host/src/wasmbus/providers

1 file changed

+25
-13
lines changed

crates/host/src/wasmbus/providers/mod.rs

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -291,20 +291,22 @@ impl Host {
291291
// When the provider is shutting down, don't restart it
292292
if shutdown.load(Ordering::Relaxed) {
293293
trace!(
294-
"provider @ [{}] exited with `{status:?}` but will not be restarted since it's shutting down",
295-
path.display()
294+
path = ?path.display(),
295+
status = ?status,
296+
"provider exited but will not be restarted since it's shutting down",
296297
);
297298
// Avoid a hot loop by waiting 1s before checking the status again
298299
tokio::time::sleep(Duration::from_secs(1)).await;
299300
continue;
300301
}
301302

302303
warn!(
303-
"restarting provider @ [{}] that exited with `{status:?}`",
304-
path.display()
304+
path = ?path.display(),
305+
status = ?status,
306+
"restarting provider that exited while being supervised",
305307
);
306308

307-
let Ok((Ok(host_data), new_config_bundle)) = self
309+
let (host_data, new_config_bundle) = match self
308310
.prepare_provider_config(
309311
&config_names,
310312
claims_token.as_ref(),
@@ -319,11 +321,20 @@ impl Host {
319321
.context("failed to serialize provider data"),
320322
Arc::new(RwLock::new(config)),
321323
)
322-
})
323-
else {
324-
error!("failed to prepare provider host data while restarting");
325-
shutdown.store(true, Ordering::Relaxed);
326-
return;
324+
}) {
325+
Ok((Ok(host_data), new_config_bundle)) => {
326+
(host_data, new_config_bundle)
327+
}
328+
Err(e) => {
329+
error!(err = ?e, "failed to prepare provider host data while restarting");
330+
shutdown.store(true, Ordering::Relaxed);
331+
return;
332+
}
333+
Ok((Err(e), _)) => {
334+
error!(err = ?e, "failed to serialize provider host data while restarting");
335+
shutdown.store(true, Ordering::Relaxed);
336+
return;
337+
}
327338
};
328339

329340
// Stop the config watcher and start a new one with the new config bundle
@@ -339,7 +350,7 @@ impl Host {
339350
// Restart the provider by attempting to re-execute the binary with the same
340351
// host data
341352
let Ok(child_cmd) = provider_command(&path, host_data).await else {
342-
error!("failed to restart provider @ [{}]", path.display());
353+
error!(path = ?path.display(), "failed to restart provider");
343354
shutdown.store(true, Ordering::Relaxed);
344355
return;
345356
};
@@ -351,8 +362,9 @@ impl Host {
351362
}
352363
Err(e) => {
353364
error!(
354-
"failed to wait for provider @ [{}] to execute: {e}",
355-
path.display()
365+
path = ?path.display(),
366+
err = ?e,
367+
"failed to wait for provider to execute",
356368
);
357369

358370
shutdown.store(true, Ordering::Relaxed);

0 commit comments

Comments
 (0)