Skip to content

Commit 6cb8111

Browse files
feat(pyth-lazer-agent): add proxy URL to logging statements for debugging
- Add proxy URL to error messages when sending/reading CONNECT requests - Add proxy URL to success log after proxy connection - Add proxy URL to final WebSocket success log for better traceability Co-Authored-By: Mike Rolish <[email protected]>
1 parent 90cdadf commit 6cb8111

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

apps/pyth-lazer-agent/src/relayer_session.rs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -77,13 +77,14 @@ async fn connect_through_proxy(
7777
stream
7878
.write_all(connect_request.as_bytes())
7979
.await
80-
.context("Failed to send CONNECT request to proxy")?;
80+
.context(format!(
81+
"Failed to send CONNECT request to proxy at {proxy_url}"
82+
))?;
8183

8284
let mut response = vec![0u8; 1024];
83-
let n = stream
84-
.read(&mut response)
85-
.await
86-
.context("Failed to read CONNECT response from proxy")?;
85+
let n = stream.read(&mut response).await.context(format!(
86+
"Failed to read CONNECT response from proxy at {proxy_url}"
87+
))?;
8788

8889
let response_str =
8990
String::from_utf8_lossy(response.get(..n).context("Invalid response slice range")?);
@@ -95,7 +96,7 @@ async fn connect_through_proxy(
9596
);
9697
}
9798

98-
tracing::info!("Successfully connected through proxy");
99+
tracing::info!("Successfully connected through proxy at {}", proxy_url);
99100

100101
let mut req = target_url.clone().into_client_request()?;
101102
let headers = req.headers_mut();
@@ -125,8 +126,9 @@ async fn connect_through_proxy(
125126
.context("Failed to complete WebSocket handshake")?;
126127

127128
tracing::info!(
128-
"WebSocket connection established to relayer at {}",
129-
target_url
129+
"WebSocket connection established to relayer at {} via proxy {}",
130+
target_url,
131+
proxy_url
130132
);
131133
Ok(ws_stream.split())
132134
}

0 commit comments

Comments
 (0)