opentelemetry-instrumentation.cr icon indicating copy to clipboard operation
opentelemetry-instrumentation.cr copied to clipboard

Create an HTTP::Websocket instrumentation module

Open wyhaines opened this issue 3 years ago • 2 comments

After having looked at the code for websocket, I think that the HTTP::Websocket class itself should be refactored some, so this will probably involve a monkeypatch to apply that refactoring, which will reduce the cyclomatic complexity of the run method while simultaneously making it a lot cleaner to instrument everything. I will then contribute that back up to core in the hope that it will be included in a future release, allowing me to remove it from this codebase and leave only the instrumentation itself.

wyhaines avatar May 02 '22 05:05 wyhaines

I had to refactor it a bit to make it work through proxies https://github.com/spider-gazelle/connect-proxy/blob/master/src/connect-proxy/websocket.cr

would be good to make a pull request to the std lib if possible might be worth starting a discussion with @asterite and @straight-shoota on the crystal forums to work through some ideas

stakach avatar May 03 '22 11:05 stakach

I just saw this. I just merged instrumentation for the standard HTTP::WebSocket library. I will take a look at your code here before I do the new release, though.

wyhaines avatar May 05 '22 01:05 wyhaines