Describe your environment
OS: Ubuntu 22.04
Python version: 3.10.12
Package version: 0.47b0
What happened?
The WebSocketHandler.finish method, called after the WebSocket upgrade, results in lost context at https://github.com/tornadoweb/tornado/blob/1f8b2d78fee5e5a15e686815e0285d4a3c831a2c/tornado/websocket.py#L929
Steps to Reproduce
from tornado import websocket, web, ioloop
class WebsocketHandler(websocket.WebSocketHandler):
def open(self):
print("WebSocket opened")
def on_message(self, message):
self.write_message(u"You said: " + message)
def on_close(self):
print("WebSocket closed")
app = web.Application([
(r'/ws', WebsocketHandler),
])
if __name__ == '__main__':
app.listen(8888)
ioloop.IOLoop.instance().start()
opentelemetry-instrument \
--traces_exporter console \
--metrics_exporter console \
--logs_exporter console \
--service_name cmc-front-end \
python \
main.py
const ws = new WebSocket("ws://localhost:8888/ws");
ws.onopen = function() {
ws.send("Hello, world");
};
ws.onmessage = function (evt) {
console.log(evt)
};
Expected Result
Context to flow from the protocol upgrade to the message handling.
Actual Result
Context is lost after the initial phase is finished.
Additional context
No response
Would you like to implement a fix?
Yes
Describe your environment
OS: Ubuntu 22.04
Python version: 3.10.12
Package version: 0.47b0
What happened?
The
WebSocketHandler.finishmethod, called after the WebSocket upgrade, results in lost context at https://github.com/tornadoweb/tornado/blob/1f8b2d78fee5e5a15e686815e0285d4a3c831a2c/tornado/websocket.py#L929Steps to Reproduce
opentelemetry-instrument \ --traces_exporter console \ --metrics_exporter console \ --logs_exporter console \ --service_name cmc-front-end \ python \ main.pyExpected Result
Context to flow from the protocol upgrade to the message handling.
Actual Result
Context is lost after the initial phase is finished.
Additional context
No response
Would you like to implement a fix?
Yes