struct OpenTelemetry::InstrumentationDocumentation::CrystalHttpWebSocket
- OpenTelemetry::InstrumentationDocumentation::CrystalHttpWebSocket
- Struct
- Value
- Object
Overview
OpenTelemetry::Instrumentation::CrystalHttpWebSocket
Instruments
- HTTP::WebSocket
Reference: https://crystal-lang.org/api/1.4.0/HTTP/WebSocket.html
This instrumentation package instruments both client and server use of HTTP::WebSocket. As of 0.3.0 of
of OpenTelemetry::Instrumentation, the package first monkey patches HTTP::WebSocket to rewrite it into a
refactored version that reduces the cyclomatic complexity
of the #run method while also making it easier to inject tracing. Those refactors are being presented back
to the main Crystal project as a proposed PR, and if they are accepted, a large chunk of the code in this
instrumentation package can be removed.
The remaining instrumentation wraps the client methods, #send, #ping, #pong, #stream, and #close,
as well as the refactored handler methods that #run depends on, #handle_ping, #handle_pong, #handle_text,
#handle_binary, #handle_close, and #handle_continuation.
Configuration
-
OTEL_CRYSTAL_DISABLE_INSTRUMENTATION_HTTP_WEBSOCKETIf set, this will disable the
HTTP::WebSocketinstrumentation.
Version Restrictions
- Crystal >= 1.0.0
Methods Affected
-
This method is refactored from the original while retaining identical functionality.
-
Wrap a
#sendcall in a client type span. -
Wrap a
#pingcall in a client type span. -
Wrap a
#pongcall in a client type span. -
Wrap a
#streamcall in a client type span. -
Wrap a
#closecall in a client type span. -
HTTP::WebSocket#handle_pingWrap a
#handle_pingcall in a server type span, with the message attached as an attribute. -
HTTP::WebSocket#handle_pongWrap a
#handle_pongcall in a server type span, with the message attached as an attribute. -
HTTP::WebSocket#handle_textWrap a
#handle_textcall in a server type span, with the message attached as an attribute. -
HTTP::WebSocket#handle_binaryWrap a
#handle_binarycall in a server type span, with the message attached as an attribute. -
HTTP::WebSocket#handle_closeWrap a
#handle_closecall in a server type span, with the close-code and the message attached as an attribute. -
HTTP::WebSocket#handle_continuationWrap a
#handle_continuationcall in a server type span.