From f617d8fb0b12b6034e91d4428dcfa96eae0f2705 Mon Sep 17 00:00:00 2001 From: Oliver Gould Date: Mon, 18 Apr 2022 15:55:55 +0000 Subject: [PATCH] outbound: Add logging for endpoint opaqueness The outbound proxy's logging doesn't make it clear how targets decide whether protocol detection is employed. This change adds debug logging to make it easier to understand these decisions. Signed-off-by: Oliver Gould --- linkerd/app/outbound/src/http/detect.rs | 2 ++ linkerd/app/outbound/src/switch_logical.rs | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/linkerd/app/outbound/src/http/detect.rs b/linkerd/app/outbound/src/http/detect.rs index 192407df16..9790a61c12 100644 --- a/linkerd/app/outbound/src/http/detect.rs +++ b/linkerd/app/outbound/src/http/detect.rs @@ -60,8 +60,10 @@ impl Outbound { // detection and just use the TCP stack directly. |target: T| -> Result<_, Infallible> { if let Some(Skip) = target.param() { + tracing::debug!("Skipping HTTP protocol detection"); return Ok(svc::Either::B(target)); } + tracing::debug!("Attempting HTTP protocol detection"); Ok(svc::Either::A(target)) }, skipped, diff --git a/linkerd/app/outbound/src/switch_logical.rs b/linkerd/app/outbound/src/switch_logical.rs index 2c77aa835d..e7bea74efe 100644 --- a/linkerd/app/outbound/src/switch_logical.rs +++ b/linkerd/app/outbound/src/switch_logical.rs @@ -35,11 +35,13 @@ impl Outbound { // If the profile provides an endpoint, then the target is single endpoint and // not a logical/load-balanced service. if let Some((addr, metadata)) = rx.endpoint() { + let is_opaque = rx.is_opaque_protocol(); + tracing::debug!(%is_opaque, "Profile describes an endpoint"); return Ok(svc::Either::A(Endpoint::from_metadata( addr, metadata, no_tls_reason, - rx.is_opaque_protocol(), + is_opaque, &*inbound_ips, ))); } @@ -47,12 +49,14 @@ impl Outbound { // Otherwise, if the profile provides a (named) logical address, then we build a // logical stack so we apply routes, traffic splits, and load balancing. if let Some(logical_addr) = rx.logical_addr() { + tracing::debug!("Profile describes a logical service"); return Ok(svc::Either::B(Logical::new(logical_addr, rx))); } } // If there was no profile or it didn't include any useful metadata, create a bare // endpoint from the original destination address. + tracing::debug!("No profile; forwarding to the original destination"); Ok(svc::Either::A(Endpoint::forward( target.param(), no_tls_reason,