diff --git a/Cargo.lock b/Cargo.lock index 081d404d..803201fd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3559,7 +3559,7 @@ dependencies = [ [[package]] name = "wit-bindgen-wrpc" -version = "0.4.1" +version = "0.4.2" dependencies = [ "anyhow", "bitflags 2.6.0", @@ -3587,7 +3587,7 @@ dependencies = [ [[package]] name = "wit-bindgen-wrpc-rust" -version = "0.4.1" +version = "0.4.2" dependencies = [ "anyhow", "clap", @@ -3603,7 +3603,7 @@ dependencies = [ [[package]] name = "wit-bindgen-wrpc-rust-macro" -version = "0.4.0" +version = "0.4.2" dependencies = [ "anyhow", "prettyplease", diff --git a/Cargo.toml b/Cargo.toml index b33402ce..83eb77f9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -127,10 +127,10 @@ wasmtime = { version = "22", default-features = false } wasmtime-wasi = { version = "22", default-features = false } wit-bindgen = { version = "0.27", default-features = false } wit-bindgen-core = { version = "0.27", default-features = false } -wit-bindgen-wrpc = { version = "0.4.1", default-features = false, path = "./crates/wit-bindgen" } +wit-bindgen-wrpc = { version = "0.4.2", default-features = false, path = "./crates/wit-bindgen" } wit-bindgen-wrpc-go = { version = "0.2", default-features = false, path = "./crates/wit-bindgen-go" } -wit-bindgen-wrpc-rust = { version = "0.4.1", default-features = false, path = "./crates/wit-bindgen-rust" } -wit-bindgen-wrpc-rust-macro = { version = "0.4", default-features = false, path = "./crates/wit-bindgen-rust-macro" } +wit-bindgen-wrpc-rust = { version = "0.4.2", default-features = false, path = "./crates/wit-bindgen-rust" } +wit-bindgen-wrpc-rust-macro = { version = "0.4.2", default-features = false, path = "./crates/wit-bindgen-rust-macro" } wit-component = { version = "0.212", default-features = false } wit-parser = { version = "0.212", default-features = false } wrpc-cli = { version = "0.2", path = "./crates/cli", default-features = false } diff --git a/crates/wit-bindgen-rust-macro/Cargo.toml b/crates/wit-bindgen-rust-macro/Cargo.toml index 46628f81..79de1cf2 100644 --- a/crates/wit-bindgen-rust-macro/Cargo.toml +++ b/crates/wit-bindgen-rust-macro/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wit-bindgen-wrpc-rust-macro" -version = "0.4.0" +version = "0.4.2" description = """ Procedural macro paired with the `wit-bindgen-wrpc` crate. """ diff --git a/crates/wit-bindgen-rust/Cargo.toml b/crates/wit-bindgen-rust/Cargo.toml index db39d48e..821fa74b 100644 --- a/crates/wit-bindgen-rust/Cargo.toml +++ b/crates/wit-bindgen-rust/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wit-bindgen-wrpc-rust" -version = "0.4.1" +version = "0.4.2" description = """ Rust bindings generator for wRPC, typically used through the `wit-bindgen-wrpc` crate's `generate!` macro. diff --git a/crates/wit-bindgen-rust/src/interface.rs b/crates/wit-bindgen-rust/src/interface.rs index 02e33e83..468f0eb7 100644 --- a/crates/wit-bindgen-rust/src/interface.rs +++ b/crates/wit-bindgen-rust/src/interface.rs @@ -326,9 +326,11 @@ pub async fn serve_interface( self.src, r#" let rx = rx.map({tracing}::Instrument::in_current_span).map({tokio}::spawn); + {tracing}::trace!(instance = "{instance}", func = "{wit_name}", "calling handler"); match {trait_name}::{name}(&handler, cx"#, tokio = self.gen.tokio_path(), tracing = self.gen.tracing_path(), + wit_name = func.name, ); for i in 0..func.params.len() { uwrite!(self.src, ", p{i}"); @@ -352,8 +354,12 @@ pub async fn serve_interface( ).await {{ Ok(()) => {{ if let Some(rx) = rx {{ - if let Err(err) = rx.await? {{ - {tracing}::warn!(?err, "failed to receive async `{instance}.{wit_name}` invocation parameters"); + {tracing}::trace!(instance = "{instance}", func = "{wit_name}", "receiving async invocation parameters"); + if let Err(err) = {anyhow}::Context::context( + rx.await, + "receipt of async `.{wit_name}` invocation parameters failed", + )? {{ + {tracing}::warn!(?err, instance = "{instance}", func = "{wit_name}", "failed to receive async invocation parameters"); }} }} continue; @@ -362,7 +368,7 @@ pub async fn serve_interface( if let Some(rx) = rx {{ rx.abort(); }} - {tracing}::warn!(?err, "failed to transmit `{instance}.{wit_name}` invocation results"); + {tracing}::warn!(?err, instance = "{instance}", func = "{wit_name}", "failed to transmit invocation results"); }} }} }}, @@ -370,14 +376,15 @@ pub async fn serve_interface( if let Some(rx) = rx {{ rx.abort(); }} - {tracing}::warn!(?err, "failed to serve `{instance}.{wit_name}` invocation"); + {tracing}::warn!(?err, instance = "{instance}", func = "{wit_name}", "failed to serve invocation"); }} }} }}, Some(Err(err)) => {{ - {tracing}::error!("failed to accept invocation"); + {tracing}::error!(?err, instance = "{instance}", func = "{wit_name}", "failed to accept invocation"); }}, None => {{ + {tracing}::warn!(instance = "{instance}", func = "{wit_name}", "invocation stream unexpectedly finished"); {anyhow}::bail!("`{instance}.{wit_name}` stream unexpectedly finished") }}, }} diff --git a/crates/wit-bindgen/Cargo.toml b/crates/wit-bindgen/Cargo.toml index 32ad5383..3ed1396d 100644 --- a/crates/wit-bindgen/Cargo.toml +++ b/crates/wit-bindgen/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wit-bindgen-wrpc" -version = "0.4.1" +version = "0.4.2" description = """ Rust bindings generator for wRPC. """