Skip to content

Commit 0dcf4e1

Browse files
authored
fix(core-response-errors): include path in structured logs (#4603)
this will give the current "no route found for request" error log more information on inbound and outbound proxies resolves linkerd/linkerd2#14193
1 parent ceff956 commit 0dcf4e1

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

linkerd/app/core/src/errors/respond.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ pub struct Respond<R> {
5555
is_orig_proto_upgrade: bool,
5656
client: Option<ClientHandle>,
5757
emit_headers: bool,
58+
uri: http::Uri,
5859
}
5960

6061
// === impl HttpRescue ===
@@ -309,6 +310,7 @@ where
309310

310311
let rescue = self.rescue.clone();
311312
let emit_headers = self.emit_headers;
313+
let uri = req.uri().clone();
312314

313315
match req.version() {
314316
http::Version::HTTP_2 => {
@@ -332,6 +334,7 @@ where
332334
is_orig_proto_upgrade: false,
333335
version: http::Version::HTTP_2,
334336
emit_headers,
337+
uri,
335338
}
336339
}
337340
version => {
@@ -343,6 +346,7 @@ where
343346
is_grpc: false,
344347
is_orig_proto_upgrade: is_h2_upgrade,
345348
emit_headers,
349+
uri,
346350
}
347351
}
348352
}
@@ -389,9 +393,9 @@ where
389393
let rsp = info_span!("rescue", client.addr = %self.client_addr()).in_scope(|| {
390394
if !self.is_grpc {
391395
let version = self.version;
392-
tracing::info!(error, "{version:?} request failed",);
396+
tracing::info!(error, path = self.uri.path(), "{version:?} request failed",);
393397
} else {
394-
tracing::info!(error, "gRPC request failed");
398+
tracing::info!(error, path = self.uri.path(), "gRPC request failed",);
395399
};
396400
self.rescue.rescue(error)
397401
})?;

0 commit comments

Comments
 (0)