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_WEBSOCKET
If set, this will disable the
HTTP::WebSocket
instrumentation.
Version Restrictions
- Crystal >= 1.0.0
Methods Affected
-
This method is refactored from the original while retaining identical functionality.
-
Wrap a
#send
call in a client type span. -
Wrap a
#ping
call in a client type span. -
Wrap a
#pong
call in a client type span. -
Wrap a
#stream
call in a client type span. -
Wrap a
#close
call in a client type span. -
HTTP::WebSocket#handle_ping
Wrap a
#handle_ping
call in a server type span, with the message attached as an attribute. -
HTTP::WebSocket#handle_pong
Wrap a
#handle_pong
call in a server type span, with the message attached as an attribute. -
HTTP::WebSocket#handle_text
Wrap a
#handle_text
call in a server type span, with the message attached as an attribute. -
HTTP::WebSocket#handle_binary
Wrap a
#handle_binary
call in a server type span, with the message attached as an attribute. -
HTTP::WebSocket#handle_close
Wrap a
#handle_close
call in a server type span, with the close-code and the message attached as an attribute. -
HTTP::WebSocket#handle_continuation
Wrap a
#handle_continuation
call in a server type span.