diff --git a/proxy/src/auth/backend.rs b/proxy/src/auth/backend.rs index 42b2304bb8..b8599adaeb 100644 --- a/proxy/src/auth/backend.rs +++ b/proxy/src/auth/backend.rs @@ -140,6 +140,7 @@ async fn auth_quirks( impl BackendType<'_, ClientCredentials<'_>> { /// Authenticate the client via the requested backend, possibly using credentials. + #[tracing::instrument(fields(allow_cleartext), skip_all)] pub async fn authenticate( &mut self, extra: &ConsoleReqExtra<'_>, diff --git a/proxy/src/proxy.rs b/proxy/src/proxy.rs index 0dc48f1212..9642047812 100644 --- a/proxy/src/proxy.rs +++ b/proxy/src/proxy.rs @@ -17,7 +17,7 @@ use once_cell::sync::Lazy; use pq_proto::{BeMessage as Be, FeStartupPacket, StartupMessageParams}; use std::sync::Arc; use tokio::io::{AsyncRead, AsyncWrite}; -use tracing::{error, info, info_span, warn, Instrument}; +use tracing::{error, info, warn}; /// Number of times we should retry the `/proxy_wake_compute` http request. const NUM_RETRIES_WAKE_COMPUTE: usize = 1; @@ -91,13 +91,13 @@ pub async fn task_main( .unwrap_or_else(|e| { // Acknowledge that the task has finished with an error. error!("per-client task finished with an error: {e:#}"); - }) - .instrument(info_span!("client", session = format_args!("{session_id}"))), + }), ); } } // TODO(tech debt): unite this with its twin below. +#[tracing::instrument(fields(session_id), skip_all)] pub async fn handle_ws_client( config: &'static ProxyConfig, cancel_map: &CancelMap, @@ -139,6 +139,7 @@ pub async fn handle_ws_client( .await } +#[tracing::instrument(fields(session_id), skip_all)] async fn handle_client( config: &'static ProxyConfig, cancel_map: &CancelMap, @@ -423,9 +424,9 @@ impl Client<'_, S> { let res = creds .authenticate(&extra, &mut stream, allow_cleartext) .await; + async { res }.or_else(|e| stream.throw_error(e)).await } - .instrument(info_span!("auth")) .await?; let AuthSuccess {