Skip to content

Commit b3ab371

Browse files
committed
Fix some outbound-http telemetry
Signed-off-by: Lann Martin <[email protected]>
1 parent 2a18a64 commit b3ab371

File tree

1 file changed

+9
-5
lines changed
  • crates/factor-outbound-http/src

1 file changed

+9
-5
lines changed

crates/factor-outbound-http/src/wasi.rs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ impl<'a> WasiHttpView for WasiHttpImplInner<'a> {
7474
skip_all,
7575
fields(
7676
otel.kind = "client",
77-
url.full = %request.uri(),
77+
url.full = Empty,
7878
http.request.method = %request.method(),
7979
otel.name = %request.method(),
8080
http.response.status_code = Empty,
@@ -127,6 +127,10 @@ async fn send_request_impl(
127127
}
128128
*uri = builder.build().unwrap();
129129
}
130+
let span = tracing::Span::current();
131+
span.record("url.full", uri.to_string());
132+
133+
spin_telemetry::inject_trace_context(&mut request);
130134

131135
if let Some(interceptor) = request_interceptor {
132136
match interceptor.intercept(&mut request, &mut config).await? {
@@ -165,17 +169,15 @@ async fn send_request_impl(
165169
config.use_tls = origin.use_tls();
166170

167171
request.headers_mut().insert(HOST, origin.host_header());
168-
spin_telemetry::inject_trace_context(&mut request);
169172

170173
let path_and_query = request.uri().path_and_query().cloned();
171174
*request.uri_mut() = origin.into_uri(path_and_query);
172175
}
173176

174177
let authority = request.uri().authority().context("authority not set")?;
175-
let current_span = tracing::Span::current();
176-
current_span.record("server.address", authority.host());
178+
span.record("server.address", authority.host());
177179
if let Some(port) = authority.port() {
178-
current_span.record("server.port", port.as_u16());
180+
span.record("server.port", port.as_u16());
179181
}
180182

181183
Ok(send_request_handler(request, config, tls_client_config, allow_private_ips).await)
@@ -315,6 +317,8 @@ async fn send_request_handler(
315317
.map_err(hyper_request_error)?
316318
.map(|body| body.map_err(hyper_request_error).boxed());
317319

320+
tracing::Span::current().record("http.response.status_code", resp.status().as_u16());
321+
318322
Ok(wasmtime_wasi_http::types::IncomingResponse {
319323
resp,
320324
worker: Some(worker),

0 commit comments

Comments
 (0)