From 35370f967f248445f51fb1c2e2814309a8403f00 Mon Sep 17 00:00:00 2001 From: Conrad Ludgate Date: Wed, 26 Jul 2023 16:03:51 +0100 Subject: [PATCH] proxy: add some connection init logs (#4812) ## Problem The first session event we emit is after we receive the first startup packet from the client. This means we can't detect any issues between TCP open and handling of the first PG packet ## Summary of changes Add some new logs for websocket upgrade and connection handling --- proxy/src/http/websocket.rs | 4 +++- proxy/src/proxy.rs | 5 +++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/proxy/src/http/websocket.rs b/proxy/src/http/websocket.rs index 5b7a87bc11..4b6e15dc3a 100644 --- a/proxy/src/http/websocket.rs +++ b/proxy/src/http/websocket.rs @@ -181,13 +181,15 @@ async fn ws_handler( // Check if the request is a websocket upgrade request. if hyper_tungstenite::is_upgrade_request(&request) { + info!(session_id = ?session_id, "performing websocket upgrade"); + let (response, websocket) = hyper_tungstenite::upgrade(&mut request, None) .map_err(|e| ApiError::BadRequest(e.into()))?; tokio::spawn(async move { if let Err(e) = serve_websocket(websocket, config, &cancel_map, session_id, host).await { - error!("error in websocket connection: {e:?}"); + error!(session_id = ?session_id, "error in websocket connection: {e:?}"); } }); diff --git a/proxy/src/proxy.rs b/proxy/src/proxy.rs index 2cdd1582ac..e37e7dc44b 100644 --- a/proxy/src/proxy.rs +++ b/proxy/src/proxy.rs @@ -196,6 +196,11 @@ pub async fn handle_client( stream: S, mode: ClientMode, ) -> anyhow::Result<()> { + info!( + protocol = mode.protocol_label(), + "handling interactive connection from client" + ); + // The `closed` counter will increase when this future is destroyed. NUM_CONNECTIONS_ACCEPTED_COUNTER .with_label_values(&[mode.protocol_label()])