opentelemetry-instrumentation.cr
opentelemetry-instrumentation.cr copied to clipboard
Create an HTTP::Websocket instrumentation module
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.
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
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.