Skip to content

Commit 92bfd89

Browse files
committed
Move some tracing code around
Signed-off-by: Caleb Schoepp <[email protected]>
1 parent 2937785 commit 92bfd89

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

crates/core/src/lib.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -205,15 +205,6 @@ impl<T: Send + OutboundWasiHttpHandler> WasiHttpView for Data<T> {
205205
where
206206
Self: Sized,
207207
{
208-
let current_span = tracing::Span::current();
209-
let uri = request.request.uri();
210-
if let Some(authority) = uri.authority() {
211-
current_span.record("server.address", authority.host());
212-
if let Some(port) = authority.port() {
213-
current_span.record("server.port", port.as_u16());
214-
}
215-
}
216-
217208
spin_telemetry::inject_trace_context(&mut request.request);
218209
T::send_request(self, request)
219210
}

crates/trigger-http/src/lib.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -706,6 +706,15 @@ impl OutboundWasiHttpHandler for HttpRuntimeData {
706706
return Self::chain_request(data, request, component_id);
707707
}
708708

709+
let current_span = tracing::Span::current();
710+
let uri = request.request.uri();
711+
if let Some(authority) = uri.authority() {
712+
current_span.record("server.address", authority.host());
713+
if let Some(port) = authority.port() {
714+
current_span.record("server.port", port.as_u16());
715+
}
716+
}
717+
709718
// TODO: This is a temporary workaround to make sure that outbound task is instrumented.
710719
// Once Wasmtime gives us the ability to do the spawn ourselves we can just call .instrument
711720
// and won't have to do this workaround.

0 commit comments

Comments
 (0)