From abd78061f1921c7e468e5b96227f932e2da4a5e4 Mon Sep 17 00:00:00 2001 From: Trevor Elliott Date: Wed, 14 Aug 2024 15:40:56 -0700 Subject: [PATCH] Emit the status code for responses, in addition to other stats --- lib/src/execute.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/src/execute.rs b/lib/src/execute.rs index 9cd982ba..5c632dce 100644 --- a/lib/src/execute.rs +++ b/lib/src/execute.rs @@ -31,7 +31,7 @@ use { time::{Duration, Instant, SystemTime}, }, tokio::sync::oneshot::{self, Sender}, - tracing::{event, info, info_span, warn, Instrument, Level}, + tracing::{event, info, info_span, warn, Level}, wasmtime::{ component::{self, Component}, Engine, GuestProfiler, InstancePre, Linker, Module, ProfilingStrategy, @@ -366,12 +366,12 @@ impl ExecuteCtx { .next_req_id .fetch_add(1, std::sync::atomic::Ordering::SeqCst); + let span = info_span!("request", id = req_id); + let _span = span.enter(); + // Spawn a separate task to run the guest code. That allows _this_ method to return a response early // if the guest sends one, while the guest continues to run afterward within its task. - let guest_handle = tokio::task::spawn( - self.run_guest(req, req_id, sender, local, remote) - .instrument(info_span!("request", id = req_id)), - ); + let guest_handle = tokio::task::spawn(self.run_guest(req, req_id, sender, local, remote)); let resp = match receiver.await { Ok(resp) => (resp, None), @@ -397,6 +397,8 @@ impl ExecuteCtx { }, }; + info!("response status: {:?}", resp.0.status()); + Ok(resp) }