proxy: propagate ws span (#4966)

Found this log on staging:
```
2023-08-10T17:42:58.573790Z  INFO handling interactive connection from client protocol="ws"
```

We seem to be losing websocket span in spawn, this patch fixes it.
This commit is contained in:
Arthur Petukhovsky
2023-08-10 22:38:22 +02:00
committed by GitHub
parent 3a71cf38c1
commit 73d7a9bc6e

View File

@@ -187,12 +187,16 @@ async fn ws_handler(
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!(session_id = ?session_id, "error in websocket connection: {e:?}");
tokio::spawn(
async move {
if let Err(e) =
serve_websocket(websocket, config, &cancel_map, session_id, host).await
{
error!(session_id = ?session_id, "error in websocket connection: {e:?}");
}
}
});
.in_current_span(),
);
// Return the response so the spawned future can continue.
Ok(response)